@@ -516,34 +516,35 @@ pub fn fake_network_test() {
516
516
send_payment ( & nodes[ 1 ] , & [ & nodes[ 3 ] ] , 8000000 ) ;
517
517
518
518
// Do some rebalance loop payments, simultaneously
519
- let mut hops = Vec :: with_capacity ( 3 ) ;
520
- hops. push ( RouteHop {
521
- pubkey : node_c_id,
522
- node_features : NodeFeatures :: empty ( ) ,
523
- short_channel_id : chan_2. 0 . contents . short_channel_id ,
524
- channel_features : ChannelFeatures :: empty ( ) ,
525
- fee_msat : 0 ,
526
- cltv_expiry_delta : chan_3. 0 . contents . cltv_expiry_delta as u32 ,
527
- maybe_announced_channel : true ,
528
- } ) ;
529
- hops. push ( RouteHop {
530
- pubkey : node_d_id,
531
- node_features : NodeFeatures :: empty ( ) ,
532
- short_channel_id : chan_3. 0 . contents . short_channel_id ,
533
- channel_features : ChannelFeatures :: empty ( ) ,
534
- fee_msat : 0 ,
535
- cltv_expiry_delta : chan_4. 1 . contents . cltv_expiry_delta as u32 ,
536
- maybe_announced_channel : true ,
537
- } ) ;
538
- hops. push ( RouteHop {
539
- pubkey : node_b_id,
540
- node_features : nodes[ 1 ] . node . node_features ( ) ,
541
- short_channel_id : chan_4. 0 . contents . short_channel_id ,
542
- channel_features : nodes[ 1 ] . node . channel_features ( ) ,
543
- fee_msat : 1000000 ,
544
- cltv_expiry_delta : TEST_FINAL_CLTV ,
545
- maybe_announced_channel : true ,
546
- } ) ;
519
+ let mut hops = vec ! [
520
+ RouteHop {
521
+ pubkey: node_c_id,
522
+ node_features: NodeFeatures :: empty( ) ,
523
+ short_channel_id: chan_2. 0 . contents. short_channel_id,
524
+ channel_features: ChannelFeatures :: empty( ) ,
525
+ fee_msat: 0 ,
526
+ cltv_expiry_delta: chan_3. 0 . contents. cltv_expiry_delta as u32 ,
527
+ maybe_announced_channel: true ,
528
+ } ,
529
+ RouteHop {
530
+ pubkey: node_d_id,
531
+ node_features: NodeFeatures :: empty( ) ,
532
+ short_channel_id: chan_3. 0 . contents. short_channel_id,
533
+ channel_features: ChannelFeatures :: empty( ) ,
534
+ fee_msat: 0 ,
535
+ cltv_expiry_delta: chan_4. 1 . contents. cltv_expiry_delta as u32 ,
536
+ maybe_announced_channel: true ,
537
+ } ,
538
+ RouteHop {
539
+ pubkey: node_b_id,
540
+ node_features: nodes[ 1 ] . node. node_features( ) ,
541
+ short_channel_id: chan_4. 0 . contents. short_channel_id,
542
+ channel_features: nodes[ 1 ] . node. channel_features( ) ,
543
+ fee_msat: 1000000 ,
544
+ cltv_expiry_delta: TEST_FINAL_CLTV ,
545
+ maybe_announced_channel: true ,
546
+ } ,
547
+ ] ;
547
548
hops[ 1 ] . fee_msat = chan_4. 1 . contents . fee_base_msat as u64
548
549
+ chan_4. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
549
550
hops[ 0 ] . fee_msat = chan_3. 0 . contents . fee_base_msat as u64
@@ -559,34 +560,35 @@ pub fn fake_network_test() {
559
560
let path: & [ _ ] = & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 1 ] ] ;
560
561
let payment_preimage_1 = send_along_route ( & nodes[ 1 ] , route, path, 1000000 ) . 0 ;
561
562
562
- let mut hops = Vec :: with_capacity ( 3 ) ;
563
- hops. push ( RouteHop {
564
- pubkey : node_d_id,
565
- node_features : NodeFeatures :: empty ( ) ,
566
- short_channel_id : chan_4. 0 . contents . short_channel_id ,
567
- channel_features : ChannelFeatures :: empty ( ) ,
568
- fee_msat : 0 ,
569
- cltv_expiry_delta : chan_3. 1 . contents . cltv_expiry_delta as u32 ,
570
- maybe_announced_channel : true ,
571
- } ) ;
572
- hops. push ( RouteHop {
573
- pubkey : node_c_id,
574
- node_features : NodeFeatures :: empty ( ) ,
575
- short_channel_id : chan_3. 0 . contents . short_channel_id ,
576
- channel_features : ChannelFeatures :: empty ( ) ,
577
- fee_msat : 0 ,
578
- cltv_expiry_delta : chan_2. 1 . contents . cltv_expiry_delta as u32 ,
579
- maybe_announced_channel : true ,
580
- } ) ;
581
- hops. push ( RouteHop {
582
- pubkey : node_b_id,
583
- node_features : nodes[ 1 ] . node . node_features ( ) ,
584
- short_channel_id : chan_2. 0 . contents . short_channel_id ,
585
- channel_features : nodes[ 1 ] . node . channel_features ( ) ,
586
- fee_msat : 1000000 ,
587
- cltv_expiry_delta : TEST_FINAL_CLTV ,
588
- maybe_announced_channel : true ,
589
- } ) ;
563
+ let mut hops = vec ! [
564
+ RouteHop {
565
+ pubkey: node_d_id,
566
+ node_features: NodeFeatures :: empty( ) ,
567
+ short_channel_id: chan_4. 0 . contents. short_channel_id,
568
+ channel_features: ChannelFeatures :: empty( ) ,
569
+ fee_msat: 0 ,
570
+ cltv_expiry_delta: chan_3. 1 . contents. cltv_expiry_delta as u32 ,
571
+ maybe_announced_channel: true ,
572
+ } ,
573
+ RouteHop {
574
+ pubkey: node_c_id,
575
+ node_features: NodeFeatures :: empty( ) ,
576
+ short_channel_id: chan_3. 0 . contents. short_channel_id,
577
+ channel_features: ChannelFeatures :: empty( ) ,
578
+ fee_msat: 0 ,
579
+ cltv_expiry_delta: chan_2. 1 . contents. cltv_expiry_delta as u32 ,
580
+ maybe_announced_channel: true ,
581
+ } ,
582
+ RouteHop {
583
+ pubkey: node_b_id,
584
+ node_features: nodes[ 1 ] . node. node_features( ) ,
585
+ short_channel_id: chan_2. 0 . contents. short_channel_id,
586
+ channel_features: nodes[ 1 ] . node. channel_features( ) ,
587
+ fee_msat: 1000000 ,
588
+ cltv_expiry_delta: TEST_FINAL_CLTV ,
589
+ maybe_announced_channel: true ,
590
+ } ,
591
+ ] ;
590
592
hops[ 1 ] . fee_msat = chan_2. 1 . contents . fee_base_msat as u64
591
593
+ chan_2. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
592
594
hops[ 0 ] . fee_msat = chan_3. 1 . contents . fee_base_msat as u64
@@ -1498,9 +1500,8 @@ pub fn claim_htlc_outputs() {
1498
1500
1499
1501
// The ChannelMonitor should claim the accepted HTLC output separately from the offered
1500
1502
// HTLC and to_self outputs.
1501
- let accepted_claim = node_txn. iter ( ) . filter ( |tx| tx. input . len ( ) == 1 ) . next ( ) . unwrap ( ) ;
1502
- let offered_to_self_claim =
1503
- node_txn. iter ( ) . filter ( |tx| tx. input . len ( ) == 2 ) . next ( ) . unwrap ( ) ;
1503
+ let accepted_claim = node_txn. iter ( ) . find ( |tx| tx. input . len ( ) == 1 ) . unwrap ( ) ;
1504
+ let offered_to_self_claim = node_txn. iter ( ) . find ( |tx| tx. input . len ( ) == 2 ) . unwrap ( ) ;
1504
1505
check_spends ! ( accepted_claim, revoked_local_txn[ 0 ] ) ;
1505
1506
check_spends ! ( offered_to_self_claim, revoked_local_txn[ 0 ] ) ;
1506
1507
assert_eq ! (
@@ -1512,7 +1513,7 @@ pub fn claim_htlc_outputs() {
1512
1513
witness_lens. insert ( offered_to_self_claim. input [ 0 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
1513
1514
witness_lens. insert ( offered_to_self_claim. input [ 1 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
1514
1515
assert_eq ! ( witness_lens. len( ) , 2 ) ;
1515
- assert_eq ! ( * witness_lens. iter( ) . skip ( 0 ) . next( ) . unwrap( ) , 77 ) ; // revoked to_local
1516
+ assert_eq ! ( * witness_lens. iter( ) . next( ) . unwrap( ) , 77 ) ; // revoked to_local
1516
1517
assert_eq ! ( * witness_lens. iter( ) . skip( 1 ) . next( ) . unwrap( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
1517
1518
1518
1519
// Finally, mine the penalty transaction and check that we get an HTLC failure after
@@ -7542,7 +7543,7 @@ pub fn test_manually_accept_inbound_channel_request() {
7542
7543
} ;
7543
7544
match & events[ 1 ] {
7544
7545
crate :: events:: Event :: ChannelPending { counterparty_node_id, .. } => {
7545
- assert_eq ! ( * & node_b_id, * counterparty_node_id) ;
7546
+ assert_eq ! ( node_b_id, * counterparty_node_id) ;
7546
7547
} ,
7547
7548
_ => panic ! ( "Unexpected event" ) ,
7548
7549
} ;
@@ -7959,7 +7960,7 @@ pub fn test_preimage_storage() {
7959
7960
7960
7961
let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
7961
7962
7962
- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) . 0 . contents . short_channel_id ;
7963
+ create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
7963
7964
7964
7965
{
7965
7966
let ( payment_hash, payment_secret) =
@@ -8002,7 +8003,7 @@ pub fn test_bad_secret_hash() {
8002
8003
let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
8003
8004
let node_b_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
8004
8005
8005
- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) . 0 . contents . short_channel_id ;
8006
+ create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
8006
8007
8007
8008
let random_hash = PaymentHash ( [ 42 ; 32 ] ) ;
8008
8009
let random_secret = PaymentSecret ( [ 43 ; 32 ] ) ;
@@ -8195,7 +8196,7 @@ pub fn test_concurrent_monitor_claim() {
8195
8196
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 10_000_000 ) ;
8196
8197
8197
8198
// Route a HTLC from node 0 to node 1 (but don't settle)
8198
- route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 9_000_000 ) . 0 ;
8199
+ route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 9_000_000 ) ;
8199
8200
8200
8201
// Copy ChainMonitor to simulate watchtower Alice and update block height her ChannelMonitor timeout HTLC onchain
8201
8202
let chain_source = test_utils:: TestChainSource :: new ( Network :: Testnet ) ;
@@ -10088,7 +10089,7 @@ fn do_test_max_dust_htlc_exposure(
10088
10089
}
10089
10090
{
10090
10091
let mut feerate_lock = chanmon_cfgs[ 0 ] . fee_estimator . sat_per_kw . lock ( ) . unwrap ( ) ;
10091
- * feerate_lock = * feerate_lock * 10 ;
10092
+ * feerate_lock *= 10 ;
10092
10093
}
10093
10094
nodes[ 0 ] . node . timer_tick_occurred ( ) ;
10094
10095
check_added_monitors ( & nodes[ 0 ] , 1 ) ;
@@ -11745,7 +11746,7 @@ pub fn test_funding_signed_event() {
11745
11746
} ;
11746
11747
match & events[ 1 ] {
11747
11748
crate :: events:: Event :: ChannelPending { counterparty_node_id, .. } => {
11748
- assert_eq ! ( * & node_b_id, * counterparty_node_id) ;
11749
+ assert_eq ! ( node_b_id, * counterparty_node_id) ;
11749
11750
} ,
11750
11751
_ => panic ! ( "Unexpected event" ) ,
11751
11752
} ;
0 commit comments