@@ -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) )
@@ -588,12 +594,14 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
588
594
let mut channel_txn = Vec :: new ( ) ;
589
595
macro_rules! make_channel {
590
596
( $source: expr, $dest: expr, $dest_keys_manager: expr, $chan_id: expr) => { {
591
- $source . peer_connected ( & $dest . get_our_node_id ( ) , & Init {
597
+ let init_dest = Init {
592
598
features: $dest. init_features( ) , networks: None , remote_network_address: None
593
- } , true ) . unwrap( ) ;
594
- $dest. peer_connected( & $source. get_our_node_id( ) , & Init {
599
+ } ;
600
+ $source. peer_connected( & $dest. get_our_node_id( ) , & init_dest, true ) . unwrap( ) ;
601
+ let init_src = Init {
595
602
features: $source. init_features( ) , networks: None , remote_network_address: None
596
- } , false ) . unwrap( ) ;
603
+ } ;
604
+ $dest. peer_connected( & $source. get_our_node_id( ) , & init_src, false ) . unwrap( ) ;
597
605
598
606
$source. create_channel( $dest. get_our_node_id( ) , 100_000 , 42 , 0 , None , None ) . unwrap( ) ;
599
607
let open_channel = {
@@ -745,8 +753,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
745
753
let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
746
754
let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
747
755
748
- let mut payment_id : u8 = 0 ;
749
- let mut payment_idx : u64 = 0 ;
756
+ let mut p_id : u8 = 0 ;
757
+ let mut p_idx : u64 = 0 ;
750
758
751
759
let mut chan_a_disconnected = false ;
752
760
let mut chan_b_disconnected = false ;
@@ -1157,23 +1165,27 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1157
1165
} ,
1158
1166
0x0e => {
1159
1167
if chan_a_disconnected {
1160
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1168
+ let init_1 = Init {
1161
1169
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 {
1170
+ } ;
1171
+ nodes[ 0 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, true ) . unwrap( ) ;
1172
+ let init_0 = Init {
1164
1173
features: nodes[ 0 ] . init_features( ) , networks: None , remote_network_address: None
1165
- } , false ) . unwrap( ) ;
1174
+ } ;
1175
+ nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & init_0, false ) . unwrap( ) ;
1166
1176
chan_a_disconnected = false ;
1167
1177
}
1168
1178
} ,
1169
1179
0x0f => {
1170
1180
if chan_b_disconnected {
1171
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1181
+ let init_2 = Init {
1172
1182
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 {
1183
+ } ;
1184
+ nodes[ 1 ] . peer_connected( & nodes[ 2 ] . get_our_node_id( ) , & init_2, true ) . unwrap( ) ;
1185
+ let init_1 = Init {
1175
1186
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1176
- } , false ) . unwrap( ) ;
1187
+ } ;
1188
+ nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, false ) . unwrap( ) ;
1177
1189
chan_b_disconnected = false ;
1178
1190
}
1179
1191
} ,
@@ -1253,61 +1265,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1253
1265
} ,
1254
1266
1255
1267
// 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 ) ; } ,
1268
+ 0x30 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1269
+ 0x31 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1270
+ 0x32 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1271
+ 0x33 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1272
+ 0x34 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1273
+ 0x35 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1274
+
1275
+ 0x38 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1276
+ 0x39 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1277
+ 0x3a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1278
+ 0x3b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1279
+ 0x3c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1280
+ 0x3d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1281
+
1282
+ 0x40 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1283
+ 0x41 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1284
+ 0x42 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1285
+ 0x43 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1286
+ 0x44 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1287
+ 0x45 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1288
+
1289
+ 0x48 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1290
+ 0x49 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1291
+ 0x4a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1292
+ 0x4b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1293
+ 0x4c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1294
+ 0x4d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1295
+
1296
+ 0x50 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1297
+ 0x51 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1298
+ 0x52 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1299
+ 0x53 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1300
+ 0x54 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1301
+ 0x55 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1302
+
1303
+ 0x58 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1304
+ 0x59 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1305
+ 0x5a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1306
+ 0x5b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1307
+ 0x5c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1308
+ 0x5d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1309
+
1310
+ 0x60 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1311
+ 0x61 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1312
+ 0x62 => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1313
+ 0x63 => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1314
+ 0x64 => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1315
+ 0x65 => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1316
+
1317
+ 0x68 => { send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1318
+ 0x69 => { send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1319
+ 0x6a => { send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1320
+ 0x6b => { send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1321
+ 0x6c => { send_hop_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1322
+ 0x6d => { send_hop_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1311
1323
1312
1324
0x80 => {
1313
1325
let mut max_feerate = last_htlc_clear_fee_a;
@@ -1377,21 +1389,25 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1377
1389
1378
1390
// Next, make sure peers are all connected to each other
1379
1391
if chan_a_disconnected {
1380
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1392
+ let init_1 = Init {
1381
1393
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 {
1394
+ } ;
1395
+ nodes[ 0 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, true ) . unwrap( ) ;
1396
+ let init_0 = Init {
1384
1397
features: nodes[ 0 ] . init_features( ) , networks: None , remote_network_address: None
1385
- } , false ) . unwrap( ) ;
1398
+ } ;
1399
+ nodes[ 1 ] . peer_connected( & nodes[ 0 ] . get_our_node_id( ) , & init_0, false ) . unwrap( ) ;
1386
1400
chan_a_disconnected = false ;
1387
1401
}
1388
1402
if chan_b_disconnected {
1389
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1403
+ let init_2 = Init {
1390
1404
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 {
1405
+ } ;
1406
+ nodes[ 1 ] . peer_connected( & nodes[ 2 ] . get_our_node_id( ) , & init_2, true ) . unwrap( ) ;
1407
+ let init_1 = Init {
1393
1408
features: nodes[ 1 ] . init_features( ) , networks: None , remote_network_address: None
1394
- } , false ) . unwrap( ) ;
1409
+ } ;
1410
+ nodes[ 2 ] . peer_connected( & nodes[ 1 ] . get_our_node_id( ) , & init_1, false ) . unwrap( ) ;
1395
1411
chan_b_disconnected = false ;
1396
1412
}
1397
1413
@@ -1411,11 +1427,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1411
1427
1412
1428
// Finally, make sure that at least one end of each channel can make a substantial payment
1413
1429
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 ) ) ;
1430
+ send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ||
1431
+ send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
1416
1432
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 ) ) ;
1433
+ send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ||
1434
+ send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
1419
1435
1420
1436
last_htlc_clear_fee_a = fee_est_a. ret_val. load( atomic:: Ordering :: Acquire ) ;
1421
1437
last_htlc_clear_fee_b = fee_est_b. ret_val. load( atomic:: Ordering :: Acquire ) ;
0 commit comments