@@ -238,6 +238,7 @@ struct KeyProvider {
238
238
impl EntropySource for KeyProvider {
239
239
fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
240
240
let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
241
+ #[ rustfmt:: skip]
241
242
let mut res = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 11 , self . node_secret [ 31 ] ] ;
242
243
res[ 30 -4 ..30 ] . copy_from_slice ( & id. to_le_bytes ( ) ) ;
243
244
res
@@ -265,7 +266,9 @@ impl NodeSigner for KeyProvider {
265
266
}
266
267
267
268
fn get_inbound_payment_key_material ( & self ) -> KeyMaterial {
268
- KeyMaterial ( [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , self . node_secret [ 31 ] ] )
269
+ #[ rustfmt:: skip]
270
+ let random_bytes = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , self . node_secret [ 31 ] ] ;
271
+ KeyMaterial ( random_bytes)
269
272
}
270
273
271
274
fn sign_invoice ( & self , _hrp_bytes : & [ u8 ] , _invoice_data : & [ u5 ] , _recipient : Recipient ) -> Result < RecoverableSignature , ( ) > {
@@ -304,6 +307,7 @@ impl SignerProvider for KeyProvider {
304
307
fn derive_channel_signer ( & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
305
308
let secp_ctx = Secp256k1 :: signing_only ( ) ;
306
309
let id = channel_keys_id[ 0 ] ;
310
+ #[ rustfmt:: skip]
307
311
let keys = InMemorySigner :: new (
308
312
& secp_ctx,
309
313
SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 4 , self . node_secret [ 31 ] ] ) . unwrap ( ) ,
@@ -336,13 +340,15 @@ impl SignerProvider for KeyProvider {
336
340
337
341
fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
338
342
let secp_ctx = Secp256k1 :: signing_only ( ) ;
343
+ #[ rustfmt:: skip]
339
344
let channel_monitor_claim_key = SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 2 , self . node_secret [ 31 ] ] ) . unwrap ( ) ;
340
345
let our_channel_monitor_claim_key_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & channel_monitor_claim_key) . serialize ( ) ) ;
341
346
Ok ( Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( our_channel_monitor_claim_key_hash) . into_script ( ) )
342
347
}
343
348
344
349
fn get_shutdown_scriptpubkey ( & self ) -> Result < ShutdownScript , ( ) > {
345
350
let secp_ctx = Secp256k1 :: signing_only ( ) ;
351
+ #[ rustfmt:: skip]
346
352
let secret_key = SecretKey :: from_slice ( & [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 3 , self . node_secret [ 31 ] ] ) . unwrap ( ) ;
347
353
let pubkey_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & secret_key) . serialize ( ) ) ;
348
354
Ok ( ShutdownScript :: new_p2wpkh ( & pubkey_hash) )
@@ -745,8 +751,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
745
751
let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
746
752
let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
747
753
748
- let mut payment_id : u8 = 0 ;
749
- let mut payment_idx : u64 = 0 ;
754
+ let mut p_id : u8 = 0 ;
755
+ let mut p_idx : u64 = 0 ;
750
756
751
757
let mut chan_a_disconnected = false ;
752
758
let mut chan_b_disconnected = false ;
@@ -1157,23 +1163,27 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1157
1163
} ,
1158
1164
0x0e => {
1159
1165
if chan_a_disconnected {
1160
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1166
+ let init_1 = Init {
1161
1167
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1162
- } , true ) . unwrap( ) ;
1163
- nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & Init {
1168
+ } ;
1169
+ nodes[ 0 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, true ) . unwrap( ) ;
1170
+ let init_0 = Init {
1164
1171
features: nodes[ 0 ] . init_features( ) , networks: None , remote_network_address: None
1165
- } , false ) . unwrap( ) ;
1172
+ } ;
1173
+ nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & init_0, false ) . unwrap( ) ;
1166
1174
chan_a_disconnected = false ;
1167
1175
}
1168
1176
} ,
1169
1177
0x0f => {
1170
1178
if chan_b_disconnected {
1171
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1179
+ let init_2 = Init {
1172
1180
features: nodes[ 2 ] . init_features( ) , networks: None , remote_network_address: None
1173
- } , true ) . unwrap( ) ;
1174
- nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & Init {
1181
+ } ;
1182
+ nodes[ 1 ] . peer_connected( & nodes[ 2 ] . get_our_node_id( ) , & init_2, true ) . unwrap( ) ;
1183
+ let init_1 = Init {
1175
1184
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1176
- } , false ) . unwrap( ) ;
1185
+ } ;
1186
+ nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, false ) . unwrap( ) ;
1177
1187
chan_b_disconnected = false ;
1178
1188
}
1179
1189
} ,
@@ -1253,61 +1263,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1253
1263
} ,
1254
1264
1255
1265
// 1/10th the channel size:
1256
- 0x30 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1257
- 0x31 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1258
- 0x32 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1259
- 0x33 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1260
- 0x34 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1261
- 0x35 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1262
-
1263
- 0x38 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1264
- 0x39 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1265
- 0x3a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1266
- 0x3b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1267
- 0x3c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1268
- 0x3d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1269
-
1270
- 0x40 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1271
- 0x41 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1272
- 0x42 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1273
- 0x43 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1274
- 0x44 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1275
- 0x45 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1276
-
1277
- 0x48 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1278
- 0x49 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1279
- 0x4a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1280
- 0x4b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1281
- 0x4c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1282
- 0x4d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1283
-
1284
- 0x50 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1285
- 0x51 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1286
- 0x52 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1287
- 0x53 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1288
- 0x54 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1289
- 0x55 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1290
-
1291
- 0x58 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1292
- 0x59 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1293
- 0x5a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1294
- 0x5b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1295
- 0x5c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1296
- 0x5d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1297
-
1298
- 0x60 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1299
- 0x61 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1300
- 0x62 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1301
- 0x63 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1302
- 0x64 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1303
- 0x65 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1304
-
1305
- 0x68 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1306
- 0x69 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1307
- 0x6a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1308
- 0x6b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1309
- 0x6c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1310
- 0x6d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1266
+ 0x30 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1267
+ 0x31 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1268
+ 0x32 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1269
+ 0x33 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1270
+ 0x34 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1271
+ 0x35 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1272
+
1273
+ 0x38 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1274
+ 0x39 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1275
+ 0x3a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1276
+ 0x3b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1277
+ 0x3c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1278
+ 0x3d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1279
+
1280
+ 0x40 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1281
+ 0x41 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1282
+ 0x42 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1283
+ 0x43 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1284
+ 0x44 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1285
+ 0x45 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1286
+
1287
+ 0x48 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1288
+ 0x49 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1289
+ 0x4a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1290
+ 0x4b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1291
+ 0x4c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1292
+ 0x4d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1293
+
1294
+ 0x50 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1295
+ 0x51 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1296
+ 0x52 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1297
+ 0x53 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1298
+ 0x54 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1299
+ 0x55 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1300
+
1301
+ 0x58 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1302
+ 0x59 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1303
+ 0x5a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1304
+ 0x5b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1305
+ 0x5c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1306
+ 0x5d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1307
+
1308
+ 0x60 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1309
+ 0x61 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1310
+ 0x62 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1311
+ 0x63 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1312
+ 0x64 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1313
+ 0x65 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1314
+
1315
+ 0x68 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1316
+ 0x69 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1317
+ 0x6a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1318
+ 0x6b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1319
+ 0x6c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1320
+ 0x6d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1311
1321
1312
1322
0x80 => {
1313
1323
let mut max_feerate = last_htlc_clear_fee_a;
@@ -1377,21 +1387,25 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1377
1387
1378
1388
// Next, make sure peers are all connected to each other
1379
1389
if chan_a_disconnected {
1380
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1390
+ let init_1 = Init {
1381
1391
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1382
- } , true ) . unwrap( ) ;
1383
- nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & Init {
1392
+ } ;
1393
+ nodes[ 0 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, true ) . unwrap( ) ;
1394
+ let init_0 = Init {
1384
1395
features: nodes[ 0 ] . init_features( ) , networks: None , remote_network_address: None
1385
- } , false ) . unwrap( ) ;
1396
+ } ;
1397
+ nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & init_0, false ) . unwrap( ) ;
1386
1398
chan_a_disconnected = false ;
1387
1399
}
1388
1400
if chan_b_disconnected {
1389
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1401
+ let init_2 = Init {
1390
1402
features: nodes[ 2 ] . init_features( ) , networks: None , remote_network_address: None
1391
- } , true ) . unwrap( ) ;
1392
- nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & Init {
1403
+ } ;
1404
+ nodes[ 1 ] . peer_connected( & nodes[ 2 ] . get_our_node_id( ) , & init_2, true ) . unwrap( ) ;
1405
+ let init_1 = Init {
1393
1406
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1394
- } , false ) . unwrap( ) ;
1407
+ } ;
1408
+ nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, false ) . unwrap( ) ;
1395
1409
chan_b_disconnected = false ;
1396
1410
}
1397
1411
@@ -1411,11 +1425,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1411
1425
1412
1426
// Finally, make sure that at least one end of each channel can make a substantial payment
1413
1427
assert!(
1414
- send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ||
1415
- send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ) ;
1428
+ send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ||
1429
+ send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
1416
1430
assert!(
1417
- send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ||
1418
- send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ) ;
1431
+ send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ||
1432
+ send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
1419
1433
1420
1434
last_htlc_clear_fee_a = fee_est_a. ret_val. load( atomic:: Ordering :: Acquire ) ;
1421
1435
last_htlc_clear_fee_b = fee_est_b. ret_val. load( atomic:: Ordering :: Acquire ) ;
0 commit comments