@@ -169,7 +169,8 @@ impl chain::Watch<TestChannelSigner> for TestChainMonitor {
169
169
fn watch_channel ( & self , funding_txo : OutPoint , monitor : channelmonitor:: ChannelMonitor < TestChannelSigner > ) -> Result < chain:: ChannelMonitorUpdateStatus , ( ) > {
170
170
let mut ser = VecWriter ( Vec :: new ( ) ) ;
171
171
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) {
173
174
panic ! ( "Already had monitor pre-watch_channel" ) ;
174
175
}
175
176
self . chain_monitor . watch_channel ( funding_txo, monitor)
@@ -267,6 +268,7 @@ impl SignerProvider for KeyProvider {
267
268
fn derive_channel_signer ( & self , channel_value_satoshis : u64 , channel_keys_id : [ u8 ; 32 ] ) -> Self :: EcdsaSigner {
268
269
let secp_ctx = Secp256k1 :: signing_only ( ) ;
269
270
let id = channel_keys_id[ 0 ] ;
271
+ #[ rustfmt:: skip]
270
272
let keys = InMemorySigner :: new (
271
273
& secp_ctx,
272
274
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 {
299
301
300
302
fn get_destination_script ( & self , _channel_keys_id : [ u8 ; 32 ] ) -> Result < ScriptBuf , ( ) > {
301
303
let secp_ctx = Secp256k1 :: signing_only ( ) ;
304
+ #[ rustfmt:: skip]
302
305
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 ( ) ;
303
306
let our_channel_monitor_claim_key_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & channel_monitor_claim_key) . serialize ( ) ) ;
304
307
Ok ( Builder :: new ( ) . push_opcode ( opcodes:: all:: OP_PUSHBYTES_0 ) . push_slice ( our_channel_monitor_claim_key_hash) . into_script ( ) )
305
308
}
306
309
307
310
fn get_shutdown_scriptpubkey ( & self ) -> Result < ShutdownScript , ( ) > {
308
311
let secp_ctx = Secp256k1 :: signing_only ( ) ;
312
+ #[ rustfmt:: skip]
309
313
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 ( ) ;
310
314
let pubkey_hash = WPubkeyHash :: hash ( & PublicKey :: from_secret_key ( & secp_ctx, & secret_key) . serialize ( ) ) ;
311
315
Ok ( ShutdownScript :: new_p2wpkh ( & pubkey_hash) )
@@ -702,8 +706,8 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
702
706
let chan_a = nodes[ 0 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
703
707
let chan_b = nodes[ 2 ] . list_usable_channels ( ) [ 0 ] . short_channel_id . unwrap ( ) ;
704
708
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 ;
707
711
708
712
let mut chan_a_disconnected = false ;
709
713
let mut chan_b_disconnected = false ;
@@ -1097,56 +1101,60 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1097
1101
} ,
1098
1102
0x0e => {
1099
1103
if chan_a_disconnected {
1100
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1104
+ let init_1 = Init {
1101
1105
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 {
1104
1109
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 ( ) ;
1106
1112
chan_a_disconnected = false ;
1107
1113
}
1108
1114
} ,
1109
1115
0x0f => {
1110
1116
if chan_b_disconnected {
1111
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1117
+ let init_2 = Init {
1112
1118
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 {
1115
1122
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 ( ) ;
1117
1125
chan_b_disconnected = false ;
1118
1126
}
1119
1127
} ,
1120
1128
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 ) ,
1127
1135
1128
- 0x16 => { process_events ! ( 0 , true ) ; } ,
1129
- 0x17 => { process_events ! ( 0 , false ) ; } ,
1136
+ 0x16 => process_events ! ( 0 , true ) ,
1137
+ 0x17 => process_events ! ( 0 , false ) ,
1130
1138
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 ) ,
1137
1145
1138
- 0x1e => { process_events ! ( 1 , true ) ; } ,
1139
- 0x1f => { process_events ! ( 1 , false ) ; } ,
1146
+ 0x1e => process_events ! ( 1 , true ) ,
1147
+ 0x1f => process_events ! ( 1 , false ) ,
1140
1148
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 ) ,
1147
1155
1148
- 0x26 => { process_events ! ( 2 , true ) ; } ,
1149
- 0x27 => { process_events ! ( 2 , false ) ; } ,
1156
+ 0x26 => process_events ! ( 2 , true ) ,
1157
+ 0x27 => process_events ! ( 2 , false ) ,
1150
1158
1151
1159
0x2c => {
1152
1160
if !chan_a_disconnected {
@@ -1193,61 +1201,61 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1193
1201
} ,
1194
1202
1195
1203
// 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 ) ,
1251
1259
1252
1260
0x80 => {
1253
1261
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) {
1401
1409
1402
1410
// Next, make sure peers are all connected to each other
1403
1411
if chan_a_disconnected {
1404
- nodes [ 0 ] . peer_connected ( & nodes [ 1 ] . get_our_node_id ( ) , & Init {
1412
+ let init_1 = Init {
1405
1413
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 {
1408
1417
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 ( ) ;
1410
1420
chan_a_disconnected = false ;
1411
1421
}
1412
1422
if chan_b_disconnected {
1413
- nodes [ 1 ] . peer_connected ( & nodes [ 2 ] . get_our_node_id ( ) , & Init {
1423
+ let init_2 = Init {
1414
1424
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 {
1417
1428
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 ( ) ;
1419
1431
chan_b_disconnected = false ;
1420
1432
}
1421
1433
@@ -1435,11 +1447,11 @@ pub fn do_test<Out: Output>(data: &[u8], underlying_out: Out, anchors: bool) {
1435
1447
1436
1448
// Finally, make sure that at least one end of each channel can make a substantial payment
1437
1449
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 ) ) ;
1440
1452
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 ) ) ;
1443
1455
1444
1456
last_htlc_clear_fee_a = fee_est_a. ret_val . load ( atomic:: Ordering :: Acquire ) ;
1445
1457
last_htlc_clear_fee_b = fee_est_b. ret_val . load ( atomic:: Ordering :: Acquire ) ;
0 commit comments