@@ -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)
@@ -267,6 +268,7 @@ impl SignerProvider for KeyProvider {
267268 fn derive_channel_signer ( & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
268269 let secp_ctx = Secp256k1 :: signing_only ( ) ;
269270 let id = channel_keys_id[ 0 ] ;
271+ #[ rustfmt:: skip]
270272 let keys = InMemorySigner :: new (
271273 & secp_ctx,
272274 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 +301,15 @@ impl SignerProvider for KeyProvider {
299301
300302 fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
301303 let secp_ctx = Secp256k1 :: signing_only ( ) ;
304+ #[ rustfmt:: skip]
302305 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 ( ) ;
303306 let our_channel_monitor_claim_key_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & channel_monitor_claim_key) . serialize ( ) ) ;
304307 Ok ( Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( our_channel_monitor_claim_key_hash) . into_script ( ) )
305308 }
306309
307310 fn get_shutdown_scriptpubkey ( & self ) -> Result < ShutdownScript , ( ) > {
308311 let secp_ctx = Secp256k1 :: signing_only ( ) ;
312+ #[ rustfmt:: skip]
309313 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 ( ) ;
310314 let pubkey_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & secret_key) . serialize ( ) ) ;
311315 Ok ( ShutdownScript :: new_p2wpkh ( & pubkey_hash) )
@@ -702,8 +706,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
702706 let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
703707 let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
704708
705- let mut payment_id : u8 = 0 ;
706- let mut payment_idx : u64 = 0 ;
709+ let mut p_id : u8 = 0 ;
710+ let mut p_idx : u64 = 0 ;
707711
708712 let mut chan_a_disconnected = false ;
709713 let mut chan_b_disconnected = false ;
@@ -1097,56 +1101,60 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
10971101 } ,
10981102 0x0e => {
10991103 if chan_a_disconnected {
1100- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1104+ let init_1 = Init {
11011105 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 {
1106+ } ;
1107+ nodes[ 0 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, true ) . unwrap ( ) ;
1108+ let init_0 = Init {
11041109 features : nodes[ 0 ] . init_features ( ) , networks : None , remote_network_address : None
1105- } , false ) . unwrap ( ) ;
1110+ } ;
1111+ nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & init_0, false ) . unwrap ( ) ;
11061112 chan_a_disconnected = false ;
11071113 }
11081114 } ,
11091115 0x0f => {
11101116 if chan_b_disconnected {
1111- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1117+ let init_2 = Init {
11121118 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 {
1119+ } ;
1120+ nodes[ 1 ] . peer_connected ( & nodes[ 2 ] . get_our_node_id ( ) , & init_2, true ) . unwrap ( ) ;
1121+ let init_1 = Init {
11151122 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1116- } , false ) . unwrap ( ) ;
1123+ } ;
1124+ nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, false ) . unwrap ( ) ;
11171125 chan_b_disconnected = false ;
11181126 }
11191127 } ,
11201128
1121- 0x10 => { process_msg_events ! ( 0 , true , ProcessMessages :: AllMessages ) ; } ,
1122- 0x11 => { process_msg_events ! ( 0 , false , ProcessMessages :: AllMessages ) ; } ,
1123- 0x12 => { process_msg_events ! ( 0 , true , ProcessMessages :: OneMessage ) ; } ,
1124- 0x13 => { process_msg_events ! ( 0 , false , ProcessMessages :: OneMessage ) ; } ,
1125- 0x14 => { process_msg_events ! ( 0 , true , ProcessMessages :: OnePendingMessage ) ; } ,
1126- 0x15 => { process_msg_events ! ( 0 , false , ProcessMessages :: OnePendingMessage ) ; } ,
1129+ 0x10 => process_msg_events ! ( 0 , true , ProcessMessages :: AllMessages ) ,
1130+ 0x11 => process_msg_events ! ( 0 , false , ProcessMessages :: AllMessages ) ,
1131+ 0x12 => process_msg_events ! ( 0 , true , ProcessMessages :: OneMessage ) ,
1132+ 0x13 => process_msg_events ! ( 0 , false , ProcessMessages :: OneMessage ) ,
1133+ 0x14 => process_msg_events ! ( 0 , true , ProcessMessages :: OnePendingMessage ) ,
1134+ 0x15 => process_msg_events ! ( 0 , false , ProcessMessages :: OnePendingMessage ) ,
11271135
1128- 0x16 => { process_events ! ( 0 , true ) ; } ,
1129- 0x17 => { process_events ! ( 0 , false ) ; } ,
1136+ 0x16 => process_events ! ( 0 , true ) ,
1137+ 0x17 => process_events ! ( 0 , false ) ,
11301138
1131- 0x18 => { process_msg_events ! ( 1 , true , ProcessMessages :: AllMessages ) ; } ,
1132- 0x19 => { process_msg_events ! ( 1 , false , ProcessMessages :: AllMessages ) ; } ,
1133- 0x1a => { process_msg_events ! ( 1 , true , ProcessMessages :: OneMessage ) ; } ,
1134- 0x1b => { process_msg_events ! ( 1 , false , ProcessMessages :: OneMessage ) ; } ,
1135- 0x1c => { process_msg_events ! ( 1 , true , ProcessMessages :: OnePendingMessage ) ; } ,
1136- 0x1d => { process_msg_events ! ( 1 , false , ProcessMessages :: OnePendingMessage ) ; } ,
1139+ 0x18 => process_msg_events ! ( 1 , true , ProcessMessages :: AllMessages ) ,
1140+ 0x19 => process_msg_events ! ( 1 , false , ProcessMessages :: AllMessages ) ,
1141+ 0x1a => process_msg_events ! ( 1 , true , ProcessMessages :: OneMessage ) ,
1142+ 0x1b => process_msg_events ! ( 1 , false , ProcessMessages :: OneMessage ) ,
1143+ 0x1c => process_msg_events ! ( 1 , true , ProcessMessages :: OnePendingMessage ) ,
1144+ 0x1d => process_msg_events ! ( 1 , false , ProcessMessages :: OnePendingMessage ) ,
11371145
1138- 0x1e => { process_events ! ( 1 , true ) ; } ,
1139- 0x1f => { process_events ! ( 1 , false ) ; } ,
1146+ 0x1e => process_events ! ( 1 , true ) ,
1147+ 0x1f => process_events ! ( 1 , false ) ,
11401148
1141- 0x20 => { process_msg_events ! ( 2 , true , ProcessMessages :: AllMessages ) ; } ,
1142- 0x21 => { process_msg_events ! ( 2 , false , ProcessMessages :: AllMessages ) ; } ,
1143- 0x22 => { process_msg_events ! ( 2 , true , ProcessMessages :: OneMessage ) ; } ,
1144- 0x23 => { process_msg_events ! ( 2 , false , ProcessMessages :: OneMessage ) ; } ,
1145- 0x24 => { process_msg_events ! ( 2 , true , ProcessMessages :: OnePendingMessage ) ; } ,
1146- 0x25 => { process_msg_events ! ( 2 , false , ProcessMessages :: OnePendingMessage ) ; } ,
1149+ 0x20 => process_msg_events ! ( 2 , true , ProcessMessages :: AllMessages ) ,
1150+ 0x21 => process_msg_events ! ( 2 , false , ProcessMessages :: AllMessages ) ,
1151+ 0x22 => process_msg_events ! ( 2 , true , ProcessMessages :: OneMessage ) ,
1152+ 0x23 => process_msg_events ! ( 2 , false , ProcessMessages :: OneMessage ) ,
1153+ 0x24 => process_msg_events ! ( 2 , true , ProcessMessages :: OnePendingMessage ) ,
1154+ 0x25 => process_msg_events ! ( 2 , false , ProcessMessages :: OnePendingMessage ) ,
11471155
1148- 0x26 => { process_events ! ( 2 , true ) ; } ,
1149- 0x27 => { process_events ! ( 2 , false ) ; } ,
1156+ 0x26 => process_events ! ( 2 , true ) ,
1157+ 0x27 => process_events ! ( 2 , false ) ,
11501158
11511159 0x2c => {
11521160 if !chan_a_disconnected {
@@ -1193,61 +1201,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
11931201 } ,
11941202
11951203 // 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 ) ; } ,
1204+ 0x30 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ,
1205+ 0x31 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ,
1206+ 0x32 => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ,
1207+ 0x33 => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ,
1208+ 0x34 => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ,
1209+ 0x35 => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ,
1210+
1211+ 0x38 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ,
1212+ 0x39 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ,
1213+ 0x3a => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ,
1214+ 0x3b => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ,
1215+ 0x3c => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000_000 , & mut p_id , & mut p_idx ) ,
1216+ 0x3d => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000_000 , & mut p_id , & mut p_idx ) ,
1217+
1218+ 0x40 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ,
1219+ 0x41 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ,
1220+ 0x42 => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ,
1221+ 0x43 => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ,
1222+ 0x44 => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100_000 , & mut p_id , & mut p_idx ) ,
1223+ 0x45 => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100_000 , & mut p_id , & mut p_idx ) ,
1224+
1225+ 0x48 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ,
1226+ 0x49 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ,
1227+ 0x4a => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ,
1228+ 0x4b => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ,
1229+ 0x4c => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10_000 , & mut p_id , & mut p_idx ) ,
1230+ 0x4d => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10_000 , & mut p_id , & mut p_idx ) ,
1231+
1232+ 0x50 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ,
1233+ 0x51 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ,
1234+ 0x52 => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ,
1235+ 0x53 => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ,
1236+ 0x54 => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1_000 , & mut p_id , & mut p_idx ) ,
1237+ 0x55 => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1_000 , & mut p_id , & mut p_idx ) ,
1238+
1239+ 0x58 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ,
1240+ 0x59 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ,
1241+ 0x5a => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ,
1242+ 0x5b => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ,
1243+ 0x5c => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 100 , & mut p_id , & mut p_idx ) ,
1244+ 0x5d => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 100 , & mut p_id , & mut p_idx ) ,
1245+
1246+ 0x60 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ,
1247+ 0x61 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ,
1248+ 0x62 => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ,
1249+ 0x63 => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ,
1250+ 0x64 => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 10 , & mut p_id , & mut p_idx ) ,
1251+ 0x65 => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 10 , & mut p_id , & mut p_idx ) ,
1252+
1253+ 0x68 => send_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ,
1254+ 0x69 => send_payment ( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ,
1255+ 0x6a => send_payment ( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ,
1256+ 0x6b => send_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ,
1257+ 0x6c => send_hop_payment ( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, & nodes[ 2 ] , chan_b, 1 , & mut p_id , & mut p_idx ) ,
1258+ 0x6d => send_hop_payment ( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, & nodes[ 0 ] , chan_a, 1 , & mut p_id , & mut p_idx ) ,
12511259
12521260 0x80 => {
12531261 let mut max_feerate = last_htlc_clear_fee_a;
@@ -1401,21 +1409,25 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
14011409
14021410 // Next, make sure peers are all connected to each other
14031411 if chan_a_disconnected {
1404- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1412+ let init_1 = Init {
14051413 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 {
1414+ } ;
1415+ nodes[ 0 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, true ) . unwrap ( ) ;
1416+ let init_0 = Init {
14081417 features : nodes[ 0 ] . init_features ( ) , networks : None , remote_network_address : None
1409- } , false ) . unwrap ( ) ;
1418+ } ;
1419+ nodes[ 1 ] . peer_connected ( & nodes[ 0 ] . get_our_node_id ( ) , & init_0, false ) . unwrap ( ) ;
14101420 chan_a_disconnected = false ;
14111421 }
14121422 if chan_b_disconnected {
1413- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1423+ let init_2 = Init {
14141424 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 {
1425+ } ;
1426+ nodes[ 1 ] . peer_connected ( & nodes[ 2 ] . get_our_node_id ( ) , & init_2, true ) . unwrap ( ) ;
1427+ let init_1 = Init {
14171428 features : nodes[ 1 ] . init_features ( ) , networks : None , remote_network_address : None
1418- } , false ) . unwrap ( ) ;
1429+ } ;
1430+ nodes[ 2 ] . peer_connected ( & nodes[ 1 ] . get_our_node_id ( ) , & init_1, false ) . unwrap ( ) ;
14191431 chan_b_disconnected = false ;
14201432 }
14211433
@@ -1435,11 +1447,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
14351447
14361448 // Finally, make sure that at least one end of each channel can make a substantial payment
14371449 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 ) ) ;
1450+ send_payment( & nodes[ 0 ] , & nodes[ 1 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ||
1451+ send_payment( & nodes[ 1 ] , & nodes[ 0 ] , chan_a, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
14401452 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 ) ) ;
1453+ send_payment( & nodes[ 1 ] , & nodes[ 2 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ||
1454+ send_payment( & nodes[ 2 ] , & nodes[ 1 ] , chan_b, 10_000_000 , & mut p_id , & mut p_idx ) ) ;
14431455
14441456 last_htlc_clear_fee_a = fee_est_a. ret_val . load ( atomic:: Ordering :: Acquire ) ;
14451457 last_htlc_clear_fee_b = fee_est_b. ret_val . load ( atomic:: Ordering :: Acquire ) ;
0 commit comments