@@ -5503,6 +5503,18 @@ mod tests {
5503
5503
fee_proportional_millionths : 0 ,
5504
5504
excess_data : Vec :: new ( )
5505
5505
} ) ;
5506
+ update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , UnsignedChannelUpdate {
5507
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
5508
+ short_channel_id : 5 ,
5509
+ timestamp : 2 ,
5510
+ flags : 3 , // disable direction 1
5511
+ cltv_expiry_delta : 0 ,
5512
+ htlc_minimum_msat : 0 ,
5513
+ htlc_maximum_msat : 200_000 ,
5514
+ fee_base_msat : 0 ,
5515
+ fee_proportional_millionths : 0 ,
5516
+ excess_data : Vec :: new ( )
5517
+ } ) ;
5506
5518
5507
5519
// Path via {node7, node2, node4} is channels {12, 13, 6, 11}.
5508
5520
// Add 100 sats to the capacities of {12, 13}, because these channels
@@ -5680,6 +5692,18 @@ mod tests {
5680
5692
fee_proportional_millionths : 0 ,
5681
5693
excess_data : Vec :: new ( )
5682
5694
} ) ;
5695
+ update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , UnsignedChannelUpdate {
5696
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
5697
+ short_channel_id : 5 ,
5698
+ timestamp : 2 ,
5699
+ flags : 3 , // disable direction 1
5700
+ cltv_expiry_delta : 0 ,
5701
+ htlc_minimum_msat : 0 ,
5702
+ htlc_maximum_msat : 200_000 ,
5703
+ fee_base_msat : 0 ,
5704
+ fee_proportional_millionths : 0 ,
5705
+ excess_data : Vec :: new ( )
5706
+ } ) ;
5683
5707
5684
5708
// Path via {node7, node2, node4} is channels {12, 13, 6, 11}.
5685
5709
// Add 100 sats to the capacities of {12, 13}, because these channels
@@ -5853,6 +5877,18 @@ mod tests {
5853
5877
fee_proportional_millionths : 0 ,
5854
5878
excess_data : Vec :: new ( )
5855
5879
} ) ;
5880
+ update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , UnsignedChannelUpdate {
5881
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
5882
+ short_channel_id : 5 ,
5883
+ timestamp : 2 ,
5884
+ flags : 3 , // Disable direction 1
5885
+ cltv_expiry_delta : 0 ,
5886
+ htlc_minimum_msat : 0 ,
5887
+ htlc_maximum_msat : 100_000 ,
5888
+ fee_base_msat : 0 ,
5889
+ fee_proportional_millionths : 0 ,
5890
+ excess_data : Vec :: new ( )
5891
+ } ) ;
5856
5892
5857
5893
// Path via {node7, node2, node4} is channels {12, 13, 6, 11}.
5858
5894
// All channels should be 100 sats capacity. But for the fee experiment,
@@ -6245,92 +6281,104 @@ mod tests {
6245
6281
let payment_params = PaymentParameters :: from_node_id ( nodes[ 6 ] , 42 ) ;
6246
6282
6247
6283
add_channel ( & gossip_sync, & secp_ctx, & our_privkey, & privkeys[ 1 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 6 ) ) , 6 ) ;
6248
- update_channel ( & gossip_sync, & secp_ctx, & our_privkey, UnsignedChannelUpdate {
6249
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6250
- short_channel_id : 6 ,
6251
- timestamp : 1 ,
6252
- flags : 0 ,
6253
- cltv_expiry_delta : ( 6 << 4 ) | 0 ,
6254
- htlc_minimum_msat : 0 ,
6255
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6256
- fee_base_msat : 0 ,
6257
- fee_proportional_millionths : 0 ,
6258
- excess_data : Vec :: new ( )
6259
- } ) ;
6284
+ for ( key, flags) in [ ( & our_privkey, 0 ) , ( & privkeys[ 1 ] , 3 ) ] {
6285
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6286
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6287
+ short_channel_id : 6 ,
6288
+ timestamp : 1 ,
6289
+ flags,
6290
+ cltv_expiry_delta : ( 6 << 4 ) | 0 ,
6291
+ htlc_minimum_msat : 0 ,
6292
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6293
+ fee_base_msat : 0 ,
6294
+ fee_proportional_millionths : 0 ,
6295
+ excess_data : Vec :: new ( )
6296
+ } ) ;
6297
+ }
6260
6298
add_or_update_node ( & gossip_sync, & secp_ctx, & privkeys[ 1 ] , NodeFeatures :: from_le_bytes ( id_to_feature_flags ( 1 ) ) , 0 ) ;
6261
6299
6262
6300
add_channel ( & gossip_sync, & secp_ctx, & privkeys[ 1 ] , & privkeys[ 4 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 5 ) ) , 5 ) ;
6263
- update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 1 ] , UnsignedChannelUpdate {
6264
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6265
- short_channel_id : 5 ,
6266
- timestamp : 1 ,
6267
- flags : 0 ,
6268
- cltv_expiry_delta : ( 5 << 4 ) | 0 ,
6269
- htlc_minimum_msat : 0 ,
6270
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6271
- fee_base_msat : 100 ,
6272
- fee_proportional_millionths : 0 ,
6273
- excess_data : Vec :: new ( )
6274
- } ) ;
6301
+ for ( key, flags) in [ ( & privkeys[ 1 ] , 0 ) , ( & privkeys[ 4 ] , 3 ) ] {
6302
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6303
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6304
+ short_channel_id : 5 ,
6305
+ timestamp : 1 ,
6306
+ flags,
6307
+ cltv_expiry_delta : ( 5 << 4 ) | 0 ,
6308
+ htlc_minimum_msat : 0 ,
6309
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6310
+ fee_base_msat : 100 ,
6311
+ fee_proportional_millionths : 0 ,
6312
+ excess_data : Vec :: new ( )
6313
+ } ) ;
6314
+ }
6275
6315
add_or_update_node ( & gossip_sync, & secp_ctx, & privkeys[ 4 ] , NodeFeatures :: from_le_bytes ( id_to_feature_flags ( 4 ) ) , 0 ) ;
6276
6316
6277
6317
add_channel ( & gossip_sync, & secp_ctx, & privkeys[ 4 ] , & privkeys[ 3 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 4 ) ) , 4 ) ;
6278
- update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 4 ] , UnsignedChannelUpdate {
6279
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6280
- short_channel_id : 4 ,
6281
- timestamp : 1 ,
6282
- flags : 0 ,
6283
- cltv_expiry_delta : ( 4 << 4 ) | 0 ,
6284
- htlc_minimum_msat : 0 ,
6285
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6286
- fee_base_msat : 0 ,
6287
- fee_proportional_millionths : 0 ,
6288
- excess_data : Vec :: new ( )
6289
- } ) ;
6318
+ for ( key, flags) in [ ( & privkeys[ 4 ] , 0 ) , ( & privkeys[ 3 ] , 3 ) ] {
6319
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6320
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6321
+ short_channel_id : 4 ,
6322
+ timestamp : 1 ,
6323
+ flags,
6324
+ cltv_expiry_delta : ( 4 << 4 ) | 0 ,
6325
+ htlc_minimum_msat : 0 ,
6326
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6327
+ fee_base_msat : 0 ,
6328
+ fee_proportional_millionths : 0 ,
6329
+ excess_data : Vec :: new ( )
6330
+ } ) ;
6331
+ }
6290
6332
add_or_update_node ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , NodeFeatures :: from_le_bytes ( id_to_feature_flags ( 3 ) ) , 0 ) ;
6291
6333
6292
6334
add_channel ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , & privkeys[ 2 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 3 ) ) , 3 ) ;
6293
- update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 3 ] , UnsignedChannelUpdate {
6294
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6295
- short_channel_id : 3 ,
6296
- timestamp : 1 ,
6297
- flags : 0 ,
6298
- cltv_expiry_delta : ( 3 << 4 ) | 0 ,
6299
- htlc_minimum_msat : 0 ,
6300
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6301
- fee_base_msat : 0 ,
6302
- fee_proportional_millionths : 0 ,
6303
- excess_data : Vec :: new ( )
6304
- } ) ;
6335
+ for ( key, flags) in [ ( & privkeys[ 3 ] , 0 ) , ( & privkeys[ 2 ] , 3 ) ] {
6336
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6337
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6338
+ short_channel_id : 3 ,
6339
+ timestamp : 1 ,
6340
+ flags,
6341
+ cltv_expiry_delta : ( 3 << 4 ) | 0 ,
6342
+ htlc_minimum_msat : 0 ,
6343
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6344
+ fee_base_msat : 0 ,
6345
+ fee_proportional_millionths : 0 ,
6346
+ excess_data : Vec :: new ( )
6347
+ } ) ;
6348
+ }
6305
6349
add_or_update_node ( & gossip_sync, & secp_ctx, & privkeys[ 2 ] , NodeFeatures :: from_le_bytes ( id_to_feature_flags ( 2 ) ) , 0 ) ;
6306
6350
6307
6351
add_channel ( & gossip_sync, & secp_ctx, & privkeys[ 2 ] , & privkeys[ 4 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 2 ) ) , 2 ) ;
6308
- update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 2 ] , UnsignedChannelUpdate {
6309
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6310
- short_channel_id : 2 ,
6311
- timestamp : 1 ,
6312
- flags : 0 ,
6313
- cltv_expiry_delta : ( 2 << 4 ) | 0 ,
6314
- htlc_minimum_msat : 0 ,
6315
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6316
- fee_base_msat : 0 ,
6317
- fee_proportional_millionths : 0 ,
6318
- excess_data : Vec :: new ( )
6319
- } ) ;
6352
+ for ( key, flags) in [ ( & privkeys[ 2 ] , 0 ) , ( & privkeys[ 4 ] , 3 ) ] {
6353
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6354
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6355
+ short_channel_id : 2 ,
6356
+ timestamp : 1 ,
6357
+ flags,
6358
+ cltv_expiry_delta : ( 2 << 4 ) | 0 ,
6359
+ htlc_minimum_msat : 0 ,
6360
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6361
+ fee_base_msat : 0 ,
6362
+ fee_proportional_millionths : 0 ,
6363
+ excess_data : Vec :: new ( )
6364
+ } ) ;
6365
+ }
6320
6366
6321
6367
add_channel ( & gossip_sync, & secp_ctx, & privkeys[ 4 ] , & privkeys[ 6 ] , ChannelFeatures :: from_le_bytes ( id_to_feature_flags ( 1 ) ) , 1 ) ;
6322
- update_channel ( & gossip_sync, & secp_ctx, & privkeys[ 4 ] , UnsignedChannelUpdate {
6323
- chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6324
- short_channel_id : 1 ,
6325
- timestamp : 1 ,
6326
- flags : 0 ,
6327
- cltv_expiry_delta : ( 1 << 4 ) | 0 ,
6328
- htlc_minimum_msat : 100 ,
6329
- htlc_maximum_msat : MAX_VALUE_MSAT ,
6330
- fee_base_msat : 0 ,
6331
- fee_proportional_millionths : 0 ,
6332
- excess_data : Vec :: new ( )
6333
- } ) ;
6368
+ for ( key, flags) in [ ( & privkeys[ 4 ] , 0 ) , ( & privkeys[ 6 ] , 3 ) ] {
6369
+ update_channel ( & gossip_sync, & secp_ctx, key, UnsignedChannelUpdate {
6370
+ chain_hash : ChainHash :: using_genesis_block ( Network :: Testnet ) ,
6371
+ short_channel_id : 1 ,
6372
+ timestamp : 1 ,
6373
+ flags,
6374
+ cltv_expiry_delta : ( 1 << 4 ) | 0 ,
6375
+ htlc_minimum_msat : 100 ,
6376
+ htlc_maximum_msat : MAX_VALUE_MSAT ,
6377
+ fee_base_msat : 0 ,
6378
+ fee_proportional_millionths : 0 ,
6379
+ excess_data : Vec :: new ( )
6380
+ } ) ;
6381
+ }
6334
6382
add_or_update_node ( & gossip_sync, & secp_ctx, & privkeys[ 6 ] , NodeFeatures :: from_le_bytes ( id_to_feature_flags ( 6 ) ) , 0 ) ;
6335
6383
6336
6384
{
0 commit comments