@@ -516,34 +516,35 @@ pub fn fake_network_test() {
516516 send_payment ( & nodes[ 1 ] , & [ & nodes[ 3 ] ] , 8000000 ) ;
517517
518518 // 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+ ] ;
547548 hops[ 1 ] . fee_msat = chan_4. 1 . contents . fee_base_msat as u64
548549 + chan_4. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
549550 hops[ 0 ] . fee_msat = chan_3. 0 . contents . fee_base_msat as u64
@@ -559,34 +560,35 @@ pub fn fake_network_test() {
559560 let path: & [ _ ] = & [ & nodes[ 2 ] , & nodes[ 3 ] , & nodes[ 1 ] ] ;
560561 let payment_preimage_1 = send_along_route ( & nodes[ 1 ] , route, path, 1000000 ) . 0 ;
561562
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+ ] ;
590592 hops[ 1 ] . fee_msat = chan_2. 1 . contents . fee_base_msat as u64
591593 + chan_2. 1 . contents . fee_proportional_millionths as u64 * hops[ 2 ] . fee_msat as u64 / 1000000 ;
592594 hops[ 0 ] . fee_msat = chan_3. 1 . contents . fee_base_msat as u64
@@ -1498,9 +1500,8 @@ pub fn claim_htlc_outputs() {
14981500
14991501 // The ChannelMonitor should claim the accepted HTLC output separately from the offered
15001502 // 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 ( ) ;
15041505 check_spends ! ( accepted_claim, revoked_local_txn[ 0 ] ) ;
15051506 check_spends ! ( offered_to_self_claim, revoked_local_txn[ 0 ] ) ;
15061507 assert_eq ! (
@@ -1512,7 +1513,7 @@ pub fn claim_htlc_outputs() {
15121513 witness_lens. insert ( offered_to_self_claim. input [ 0 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
15131514 witness_lens. insert ( offered_to_self_claim. input [ 1 ] . witness . last ( ) . unwrap ( ) . len ( ) ) ;
15141515 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
15161517 assert_eq ! ( * witness_lens. iter( ) . skip( 1 ) . next( ) . unwrap( ) , OFFERED_HTLC_SCRIPT_WEIGHT ) ;
15171518
15181519 // 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() {
75427543 } ;
75437544 match & events[ 1 ] {
75447545 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) ;
75467547 } ,
75477548 _ => panic ! ( "Unexpected event" ) ,
75487549 } ;
@@ -7959,7 +7960,7 @@ pub fn test_preimage_storage() {
79597960
79607961 let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
79617962
7962- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) . 0 . contents . short_channel_id ;
7963+ create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
79637964
79647965 {
79657966 let ( payment_hash, payment_secret) =
@@ -8002,7 +8003,7 @@ pub fn test_bad_secret_hash() {
80028003 let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
80038004 let node_b_id = nodes[ 1 ] . node . get_our_node_id ( ) ;
80048005
8005- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) . 0 . contents . short_channel_id ;
8006+ create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
80068007
80078008 let random_hash = PaymentHash ( [ 42 ; 32 ] ) ;
80088009 let random_secret = PaymentSecret ( [ 43 ; 32 ] ) ;
@@ -8195,7 +8196,7 @@ pub fn test_concurrent_monitor_claim() {
81958196 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 10_000_000 ) ;
81968197
81978198 // 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 ) ;
81998200
82008201 // Copy ChainMonitor to simulate watchtower Alice and update block height her ChannelMonitor timeout HTLC onchain
82018202 let chain_source = test_utils:: TestChainSource :: new ( Network :: Testnet ) ;
@@ -10088,7 +10089,7 @@ fn do_test_max_dust_htlc_exposure(
1008810089 }
1008910090 {
1009010091 let mut feerate_lock = chanmon_cfgs[ 0 ] . fee_estimator . sat_per_kw . lock ( ) . unwrap ( ) ;
10091- * feerate_lock = * feerate_lock * 10 ;
10092+ * feerate_lock *= 10 ;
1009210093 }
1009310094 nodes[ 0 ] . node . timer_tick_occurred ( ) ;
1009410095 check_added_monitors ( & nodes[ 0 ] , 1 ) ;
@@ -11745,7 +11746,7 @@ pub fn test_funding_signed_event() {
1174511746 } ;
1174611747 match & events[ 1 ] {
1174711748 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) ;
1174911750 } ,
1175011751 _ => panic ! ( "Unexpected event" ) ,
1175111752 } ;
0 commit comments