@@ -238,6 +238,7 @@ struct KeyProvider {
238238impl EntropySource for KeyProvider {
239239 fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
240240 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
241+ #[ rustfmt:: skip]
241242 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 ] ] ;
242243 res[ 30 -4 ..30 ] . copy_from_slice ( & id. to_le_bytes ( ) ) ;
243244 res
@@ -265,7 +266,9 @@ impl NodeSigner for KeyProvider {
265266 }
266267
267268 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)
269272 }
270273
271274 fn sign_invoice ( & self , _hrp_bytes : & [ u8 ] , _invoice_data : & [ u5 ] , _recipient : Recipient ) -> Result < RecoverableSignature , ( ) > {
@@ -304,6 +307,7 @@ impl SignerProvider for KeyProvider {
304307 fn derive_channel_signer ( & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
305308 let secp_ctx = Secp256k1 :: signing_only ( ) ;
306309 let id = channel_keys_id[ 0 ] ;
310+ #[ rustfmt:: skip]
307311 let keys = InMemorySigner :: new (
308312 & secp_ctx,
309313 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 {
336340
337341 fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
338342 let secp_ctx = Secp256k1 :: signing_only ( ) ;
343+ #[ rustfmt:: skip]
339344 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 ( ) ;
340345 let our_channel_monitor_claim_key_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & channel_monitor_claim_key) . serialize ( ) ) ;
341346 Ok ( Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( our_channel_monitor_claim_key_hash) . into_script ( ) )
342347 }
343348
344349 fn get_shutdown_scriptpubkey ( & self ) -> Result < ShutdownScript , ( ) > {
345350 let secp_ctx = Secp256k1 :: signing_only ( ) ;
351+ #[ rustfmt:: skip]
346352 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 ( ) ;
347353 let pubkey_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & secret_key) . serialize ( ) ) ;
348354 Ok ( ShutdownScript :: new_p2wpkh ( & pubkey_hash) )
@@ -588,12 +594,14 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
588594 let mut channel_txn = Vec :: new ( ) ;
589595 macro_rules! make_channel {
590596 ( $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 {
592598 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 {
595602 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( ) ;
597605
598606 $source. create_channel( $dest. get_our_node_id( ) , 100_000 , 42 , 0 , None , None ) . unwrap( ) ;
599607 let open_channel = {
@@ -745,8 +753,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
745753 let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
746754 let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
747755
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 ;
750758
751759 let mut chan_a_disconnected = false ;
752760 let mut chan_b_disconnected = false ;
@@ -1157,23 +1165,27 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
11571165 } ,
11581166 0x0e => {
11591167 if chan_a_disconnected {
1160- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1168+ let init_1 = Init {
11611169 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 {
11641173 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( ) ;
11661176 chan_a_disconnected = false ;
11671177 }
11681178 } ,
11691179 0x0f => {
11701180 if chan_b_disconnected {
1171- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1181+ let init_2 = Init {
11721182 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 {
11751186 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( ) ;
11771189 chan_b_disconnected = false ;
11781190 }
11791191 } ,
@@ -1253,61 +1265,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
12531265 } ,
12541266
12551267 // 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 ) ; } ,
13111323
13121324 0x80 => {
13131325 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) {
13771389
13781390 // Next, make sure peers are all connected to each other
13791391 if chan_a_disconnected {
1380- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1392+ let init_1 = Init {
13811393 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 {
13841397 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( ) ;
13861400 chan_a_disconnected = false ;
13871401 }
13881402 if chan_b_disconnected {
1389- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1403+ let init_2 = Init {
13901404 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 {
13931408 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( ) ;
13951411 chan_b_disconnected = false ;
13961412 }
13971413
@@ -1411,11 +1427,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
14111427
14121428 // Finally, make sure that at least one end of each channel can make a substantial payment
14131429 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 ) ) ;
14161432 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 ) ) ;
14191435
14201436 last_htlc_clear_fee_a = fee_est_a. ret_val. load( atomic:: Ordering :: Acquire ) ;
14211437 last_htlc_clear_fee_b = fee_est_b. ret_val. load( atomic:: Ordering :: Acquire ) ;
0 commit comments