@@ -169,7 +169,8 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
169169 fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < TestChannelSigner > ) -> Result < chain:: ChannelMonitorUpdateStatus , ( ) > {
170170 let mut ser = VecWriter ( Vec :: new ( ) ) ;
171171 monitor. write ( & mut ser) . unwrap ( ) ;
172- if let Some ( _) = self . latest_monitors . lock ( ) . unwrap ( ) . insert ( funding_txo, ( monitor. get_latest_update_id ( ) , ser. 0 ) ) {
172+ let ser_monitor = ( monitor. get_latest_update_id ( ) , ser. 0 ) ;
173+ if let Some ( _) = self . latest_monitors . lock ( ) . unwrap ( ) . insert ( funding_txo, ser_monitor) {
173174 panic ! ( "Already had monitor pre-watch_channel" ) ;
174175 }
175176 self . chain_monitor . watch_channel ( funding_txo, monitor)
@@ -201,6 +202,7 @@ struct KeyProvider {
201202impl EntropySource for KeyProvider {
202203 fn get_secure_random_bytes ( & self ) -> [ u8 ; 32 ] {
203204 let id = self . rand_bytes_id . fetch_add ( 1 , atomic:: Ordering :: Relaxed ) ;
205+ #[ rustfmt:: skip]
204206 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 ] ] ;
205207 res[ 30 -4 ..30 ] . copy_from_slice ( & id. to_le_bytes ( ) ) ;
206208 res
@@ -228,7 +230,9 @@ impl NodeSigner for KeyProvider {
228230 }
229231
230232 fn get_inbound_payment_key_material ( & self ) -> KeyMaterial {
231- 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 ] ] )
233+ #[ rustfmt:: skip]
234+ 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 ] ] ;
235+ KeyMaterial ( random_bytes)
232236 }
233237
234238 fn sign_invoice ( & self , _hrp_bytes : & [ u8 ] , _invoice_data : & [ u5 ] , _recipient : Recipient ) -> Result < RecoverableSignature , ( ) > {
@@ -267,6 +271,7 @@ impl SignerProvider for KeyProvider {
267271 fn derive_channel_signer ( & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
268272 let secp_ctx = Secp256k1 :: signing_only ( ) ;
269273 let id = channel_keys_id[ 0 ] ;
274+ #[ rustfmt:: skip]
270275 let keys = InMemorySigner :: new (
271276 & secp_ctx,
272277 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 ( ) ,
@@ -299,13 +304,15 @@ impl SignerProvider for KeyProvider {
299304
300305 fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
301306 let secp_ctx = Secp256k1 :: signing_only ( ) ;
307+ #[ rustfmt:: skip]
302308 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 ( ) ;
303309 let our_channel_monitor_claim_key_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & channel_monitor_claim_key) . serialize ( ) ) ;
304310 Ok ( Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( our_channel_monitor_claim_key_hash) . into_script ( ) )
305311 }
306312
307313 fn get_shutdown_scriptpubkey ( & self ) -> Result < ShutdownScript , ( ) > {
308314 let secp_ctx = Secp256k1 :: signing_only ( ) ;
315+ #[ rustfmt:: skip]
309316 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 ( ) ;
310317 let pubkey_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & secret_key) . serialize ( ) ) ;
311318 Ok ( ShutdownScript :: new_p2wpkh ( & pubkey_hash) )
@@ -702,8 +709,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
702709 let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
703710 let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
704711
705- let mut payment_id : u8 = 0 ;
706- let mut payment_idx : u64 = 0 ;
712+ let mut p_id : u8 = 0 ;
713+ let mut p_idx : u64 = 0 ;
707714
708715 let mut chan_a_disconnected = false ;
709716 let mut chan_b_disconnected = false ;
@@ -1097,23 +1104,27 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
10971104 } ,
10981105 0x0e => {
10991106 if chan_a_disconnected {
1100- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1107+ let init_1 = Init {
11011108 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1102- } , true ) . unwrap ( ) ;
1103- nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & Init {
1109+ } ;
1110+ nodes[ 0 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, true ) . unwrap ( ) ;
1111+ let init_0 = Init {
11041112 features : nodes[ 0 ] . init_features ( ) , networks : None , remote_network_address : None
1105- } , false ) . unwrap ( ) ;
1113+ } ;
1114+ nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & init_0, false ) . unwrap ( ) ;
11061115 chan_a_disconnected = false ;
11071116 }
11081117 } ,
11091118 0x0f => {
11101119 if chan_b_disconnected {
1111- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1120+ let init_2 = Init {
11121121 features : nodes[ 2 ] . init_features ( ) , networks : None , remote_network_address : None
1113- } , true ) . unwrap ( ) ;
1114- nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & Init {
1122+ } ;
1123+ nodes[ 1 ] . peer_connected ( & nodes[ 2 ] . get_our_node_id ( ) , & init_2, true ) . unwrap ( ) ;
1124+ let init_1 = Init {
11151125 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1116- } , false ) . unwrap ( ) ;
1126+ } ;
1127+ nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, false ) . unwrap ( ) ;
11171128 chan_b_disconnected = false ;
11181129 }
11191130 } ,
@@ -1193,61 +1204,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
11931204 } ,
11941205
11951206 // 1/10th the channel size:
1196- 0x30 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1197- 0x31 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1198- 0x32 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1199- 0x33 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1200- 0x34 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1201- 0x35 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1202-
1203- 0x38 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1204- 0x39 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1205- 0x3a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1206- 0x3b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1207- 0x3c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1208- 0x3d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut payment_id , & mut payment_idx ) ; } ,
1209-
1210- 0x40 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1211- 0x41 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1212- 0x42 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1213- 0x43 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1214- 0x44 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1215- 0x45 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut payment_id , & mut payment_idx ) ; } ,
1216-
1217- 0x48 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1218- 0x49 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1219- 0x4a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1220- 0x4b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1221- 0x4c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1222- 0x4d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut payment_id , & mut payment_idx ) ; } ,
1223-
1224- 0x50 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1225- 0x51 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1226- 0x52 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1227- 0x53 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1228- 0x54 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1229- 0x55 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut payment_id , & mut payment_idx ) ; } ,
1230-
1231- 0x58 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1232- 0x59 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1233- 0x5a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1234- 0x5b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1235- 0x5c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1236- 0x5d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut payment_id , & mut payment_idx ) ; } ,
1237-
1238- 0x60 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1239- 0x61 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1240- 0x62 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1241- 0x63 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1242- 0x64 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1243- 0x65 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut payment_id , & mut payment_idx ) ; } ,
1244-
1245- 0x68 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1246- 0x69 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1247- 0x6a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1248- 0x6b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1249- 0x6c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1250- 0x6d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut payment_id , & mut payment_idx ) ; } ,
1207+ 0x30 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1208+ 0x31 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1209+ 0x32 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1210+ 0x33 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1211+ 0x34 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1212+ 0x35 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ; } ,
1213+
1214+ 0x38 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1215+ 0x39 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1216+ 0x3a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1217+ 0x3b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1218+ 0x3c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1219+ 0x3d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ; } ,
1220+
1221+ 0x40 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1222+ 0x41 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1223+ 0x42 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1224+ 0x43 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1225+ 0x44 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1226+ 0x45 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ; } ,
1227+
1228+ 0x48 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1229+ 0x49 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1230+ 0x4a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1231+ 0x4b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1232+ 0x4c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1233+ 0x4d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ; } ,
1234+
1235+ 0x50 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1236+ 0x51 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1237+ 0x52 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1238+ 0x53 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1239+ 0x54 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1240+ 0x55 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ; } ,
1241+
1242+ 0x58 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1243+ 0x59 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1244+ 0x5a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1245+ 0x5b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1246+ 0x5c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ; } ,
1247+ 0x5d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ; } ,
1248+
1249+ 0x60 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1250+ 0x61 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1251+ 0x62 => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1252+ 0x63 => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1253+ 0x64 => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ; } ,
1254+ 0x65 => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ; } ,
1255+
1256+ 0x68 => { send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1257+ 0x69 => { send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
1258+ 0x6a => { send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1259+ 0x6b => { send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1260+ 0x6c => { send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ; } ,
1261+ 0x6d => { send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ; } ,
12511262
12521263 0x80 => {
12531264 let mut max_feerate = last_htlc_clear_fee_a;
@@ -1401,21 +1412,25 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
14011412
14021413 // Next, make sure peers are all connected to each other
14031414 if chan_a_disconnected {
1404- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1415+ let init_1 = Init {
14051416 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1406- } , true ) . unwrap ( ) ;
1407- nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & Init {
1417+ } ;
1418+ nodes[ 0 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, true ) . unwrap ( ) ;
1419+ let init_0 = Init {
14081420 features : nodes[ 0 ] . init_features ( ) , networks : None , remote_network_address : None
1409- } , false ) . unwrap ( ) ;
1421+ } ;
1422+ nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & init_0, false ) . unwrap ( ) ;
14101423 chan_a_disconnected = false ;
14111424 }
14121425 if chan_b_disconnected {
1413- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1426+ let init_2 = Init {
14141427 features : nodes[ 2 ] . init_features ( ) , networks : None , remote_network_address : None
1415- } , true ) . unwrap ( ) ;
1416- nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & Init {
1428+ } ;
1429+ nodes[ 1 ] . peer_connected ( & nodes[ 2 ] . get_our_node_id ( ) , & init_2, true ) . unwrap ( ) ;
1430+ let init_1 = Init {
14171431 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1418- } , false ) . unwrap ( ) ;
1432+ } ;
1433+ nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, false ) . unwrap ( ) ;
14191434 chan_b_disconnected = false ;
14201435 }
14211436
@@ -1435,11 +1450,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
14351450
14361451 // Finally, make sure that at least one end of each channel can make a substantial payment
14371452 assert ! (
1438- send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ||
1439- send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut payment_id , & mut payment_idx ) ) ;
1453+ send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ||
1454+ send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
14401455 assert ! (
1441- send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ||
1442- send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut payment_id , & mut payment_idx ) ) ;
1456+ send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ||
1457+ send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
14431458
14441459 last_htlc_clear_fee_a = fee_est_a. ret_val . load ( atomic:: Ordering :: Acquire ) ;
14451460 last_htlc_clear_fee_b = fee_est_b. ret_val . load ( atomic:: Ordering :: Acquire ) ;
0 commit comments