@@ -16,9 +16,9 @@ use crate::ln::msgs::{
16
16
} ;
17
17
use crate :: ln:: outbound_payment:: RecipientOnionFields ;
18
18
use crate :: sign:: ecdsa:: EcdsaChannelSigner ;
19
+ use crate :: types:: features:: ChannelTypeFeatures ;
19
20
use crate :: util:: config:: UserConfig ;
20
21
use crate :: util:: errors:: APIError ;
21
- use crate :: types:: features:: ChannelTypeFeatures ;
22
22
23
23
use lightning_macros:: xtest;
24
24
@@ -66,17 +66,20 @@ pub fn test_async_inbound_update_fee() {
66
66
67
67
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
68
68
assert_eq ! ( events_0. len( ) , 1 ) ;
69
- let ( update_msg, commitment_signed) = match events_0[ 0 ] { // (1)
70
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
71
- ( update_fee. as_ref ( ) , commitment_signed)
72
- } ,
69
+ let ( update_msg, commitment_signed) = match events_0[ 0 ] {
70
+ // (1)
71
+ MessageSendEvent :: UpdateHTLCs {
72
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
73
+ ..
74
+ } => ( update_fee. as_ref ( ) , commitment_signed) ,
73
75
_ => panic ! ( "Unexpected event" ) ,
74
76
} ;
75
77
76
78
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_msg. unwrap ( ) ) ;
77
79
78
80
// ...but before it's delivered, nodes[1] starts to send a payment back to nodes[0]...
79
- let ( route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 40000 ) ;
81
+ let ( route, our_payment_hash, _, our_payment_secret) =
82
+ get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 40000 ) ;
80
83
let onion = RecipientOnionFields :: secret_only ( our_payment_secret) ;
81
84
let id = PaymentId ( our_payment_hash. 0 ) ;
82
85
nodes[ 1 ] . node . send_payment_with_route ( route, our_payment_hash, onion, id) . unwrap ( ) ;
@@ -136,7 +139,7 @@ pub fn test_async_inbound_update_fee() {
136
139
let events_2 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
137
140
assert_eq ! ( events_2. len( ) , 1 ) ;
138
141
match events_2[ 0 ] {
139
- Event :: PendingHTLCsForwardable { .. } => { } , // If we actually processed we'd receive the payment
142
+ Event :: PendingHTLCsForwardable { .. } => { } , // If we actually processed we'd receive the payment
140
143
_ => panic ! ( "Unexpected event" ) ,
141
144
}
142
145
@@ -171,17 +174,20 @@ pub fn test_update_fee_unordered_raa() {
171
174
172
175
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
173
176
assert_eq ! ( events_0. len( ) , 1 ) ;
174
- let update_msg = match events_0[ 0 ] { // (1)
175
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, .. } , .. } => {
176
- update_fee. as_ref ( )
177
- } ,
177
+ let update_msg = match events_0[ 0 ] {
178
+ // (1)
179
+ MessageSendEvent :: UpdateHTLCs {
180
+ updates : msgs:: CommitmentUpdate { ref update_fee, .. } ,
181
+ ..
182
+ } => update_fee. as_ref ( ) ,
178
183
_ => panic ! ( "Unexpected event" ) ,
179
184
} ;
180
185
181
186
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_msg. unwrap ( ) ) ;
182
187
183
188
// ...but before it's delivered, nodes[1] starts to send a payment back to nodes[0]...
184
- let ( route, our_payment_hash, _, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 40000 ) ;
189
+ let ( route, our_payment_hash, _, our_payment_secret) =
190
+ get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 40000 ) ;
185
191
let onion = RecipientOnionFields :: secret_only ( our_payment_secret) ;
186
192
let id = PaymentId ( our_payment_hash. 0 ) ;
187
193
nodes[ 1 ] . node . send_payment_with_route ( route, our_payment_hash, onion, id) . unwrap ( ) ;
@@ -251,10 +257,12 @@ pub fn test_multi_flight_update_fee() {
251
257
252
258
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
253
259
assert_eq ! ( events_0. len( ) , 1 ) ;
254
- let ( update_msg_1, commitment_signed_1) = match events_0[ 0 ] { // (1)
255
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
256
- ( update_fee. as_ref ( ) . unwrap ( ) , commitment_signed)
257
- } ,
260
+ let ( update_msg_1, commitment_signed_1) = match events_0[ 0 ] {
261
+ // (1)
262
+ MessageSendEvent :: UpdateHTLCs {
263
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
264
+ ..
265
+ } => ( update_fee. as_ref ( ) . unwrap ( ) , commitment_signed) ,
258
266
_ => panic ! ( "Unexpected event" ) ,
259
267
} ;
260
268
@@ -296,7 +304,10 @@ pub fn test_multi_flight_update_fee() {
296
304
assert ! ( as_second_update. update_fail_malformed_htlcs. is_empty( ) ) ;
297
305
// Check that the update_fee newly generated matches what we delivered:
298
306
assert_eq ! ( as_second_update. update_fee. as_ref( ) . unwrap( ) . channel_id, update_msg_2. channel_id) ;
299
- assert_eq ! ( as_second_update. update_fee. as_ref( ) . unwrap( ) . feerate_per_kw, update_msg_2. feerate_per_kw) ;
307
+ assert_eq ! (
308
+ as_second_update. update_fee. as_ref( ) . unwrap( ) . feerate_per_kw,
309
+ update_msg_2. feerate_per_kw
310
+ ) ;
300
311
301
312
// Deliver (2) commitment_signed
302
313
nodes[ 0 ] . node . handle_commitment_signed_batch_test ( node_b_id, & bs_commitment_signed) ;
@@ -309,7 +320,9 @@ pub fn test_multi_flight_update_fee() {
309
320
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
310
321
311
322
// Delever (4)
312
- nodes[ 1 ] . node . handle_commitment_signed_batch_test ( node_a_id, & as_second_update. commitment_signed ) ;
323
+ nodes[ 1 ]
324
+ . node
325
+ . handle_commitment_signed_batch_test ( node_a_id, & as_second_update. commitment_signed ) ;
313
326
let ( bs_second_revoke, bs_second_commitment) = get_revoke_commit_msgs ! ( nodes[ 1 ] , node_a_id) ;
314
327
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
315
328
@@ -349,9 +362,10 @@ pub fn test_update_fee_vanilla() {
349
362
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
350
363
assert_eq ! ( events_0. len( ) , 1 ) ;
351
364
let ( update_msg, commitment_signed) = match events_0[ 0 ] {
352
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
353
- ( update_fee. as_ref ( ) , commitment_signed)
354
- } ,
365
+ MessageSendEvent :: UpdateHTLCs {
366
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
367
+ ..
368
+ } => ( update_fee. as_ref ( ) , commitment_signed) ,
355
369
_ => panic ! ( "Unexpected event" ) ,
356
370
} ;
357
371
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_msg. unwrap ( ) ) ;
@@ -386,7 +400,13 @@ pub fn test_update_fee_that_funder_cannot_afford() {
386
400
387
401
let channel_value = 5000 ;
388
402
let push_sats = 700 ;
389
- let chan = create_announced_chan_between_nodes_with_value ( & nodes, 0 , 1 , channel_value, push_sats * 1000 ) ;
403
+ let chan = create_announced_chan_between_nodes_with_value (
404
+ & nodes,
405
+ 0 ,
406
+ 1 ,
407
+ channel_value,
408
+ push_sats * 1000 ,
409
+ ) ;
390
410
let channel_id = chan. 2 ;
391
411
let secp_ctx = Secp256k1 :: new ( ) ;
392
412
let default_config = UserConfig :: default ( ) ;
@@ -399,8 +419,12 @@ pub fn test_update_fee_that_funder_cannot_afford() {
399
419
// CONCURRENT_INBOUND_HTLC_FEE_BUFFER HTLCs before actually running out of local balance, so we
400
420
// calculate two different feerates here - the expected local limit as well as the expected
401
421
// remote limit.
402
- let feerate = ( ( channel_value - bs_channel_reserve_sats - push_sats) * 1000 / ( commitment_tx_base_weight ( & channel_type_features) + CONCURRENT_INBOUND_HTLC_FEE_BUFFER as u64 * COMMITMENT_TX_WEIGHT_PER_HTLC ) ) as u32 ;
403
- let non_buffer_feerate = ( ( channel_value - bs_channel_reserve_sats - push_sats) * 1000 / commitment_tx_base_weight ( & channel_type_features) ) as u32 ;
422
+ let feerate = ( ( channel_value - bs_channel_reserve_sats - push_sats) * 1000
423
+ / ( commitment_tx_base_weight ( & channel_type_features)
424
+ + CONCURRENT_INBOUND_HTLC_FEE_BUFFER as u64 * COMMITMENT_TX_WEIGHT_PER_HTLC ) )
425
+ as u32 ;
426
+ let non_buffer_feerate = ( ( channel_value - bs_channel_reserve_sats - push_sats) * 1000
427
+ / commitment_tx_base_weight ( & channel_type_features) ) as u32 ;
404
428
{
405
429
let mut feerate_lock = chanmon_cfgs[ 0 ] . fee_estimator . sat_per_kw . lock ( ) . unwrap ( ) ;
406
430
* feerate_lock = feerate;
@@ -420,7 +444,8 @@ pub fn test_update_fee_that_funder_cannot_afford() {
420
444
//We made sure neither party's funds are below the dust limit and there are no HTLCs here
421
445
assert_eq ! ( commitment_tx. output. len( ) , 2 ) ;
422
446
let total_fee: u64 = commit_tx_fee_msat ( feerate, 0 , & channel_type_features) / 1000 ;
423
- let mut actual_fee = commitment_tx. output . iter ( ) . fold ( 0 , |acc, output| acc + output. value . to_sat ( ) ) ;
447
+ let mut actual_fee =
448
+ commitment_tx. output . iter ( ) . fold ( 0 , |acc, output| acc + output. value . to_sat ( ) ) ;
424
449
actual_fee = channel_value - actual_fee;
425
450
assert_eq ! ( total_fee, actual_fee) ;
426
451
}
@@ -451,15 +476,18 @@ pub fn test_update_fee_that_funder_cannot_afford() {
451
476
let mut per_peer_lock;
452
477
let mut peer_state_lock;
453
478
454
- let local_chan = get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , per_peer_lock, peer_state_lock, chan. 2 ) ;
479
+ let local_chan =
480
+ get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , per_peer_lock, peer_state_lock, chan. 2 ) ;
455
481
let local_chan_signer = local_chan. as_funded ( ) . unwrap ( ) . get_signer ( ) ;
456
482
457
483
let nondust_htlcs: Vec < HTLCOutputInCommitment > = vec ! [ ] ;
458
484
let commitment_tx = CommitmentTransaction :: new (
459
485
INITIAL_COMMITMENT_NUMBER - 1 ,
460
486
& remote_point,
461
487
push_sats,
462
- channel_value - push_sats - commit_tx_fee_msat ( non_buffer_feerate + 4 , 0 , & channel_type_features) / 1000 ,
488
+ channel_value
489
+ - push_sats - commit_tx_fee_msat ( non_buffer_feerate + 4 , 0 , & channel_type_features)
490
+ / 1000 ,
463
491
non_buffer_feerate + 4 ,
464
492
nondust_htlcs,
465
493
& local_chan. funding ( ) . channel_transaction_parameters . as_counterparty_broadcastable ( ) ,
@@ -482,10 +510,7 @@ pub fn test_update_fee_that_funder_cannot_afford() {
482
510
partial_signature_with_nonce : None ,
483
511
} ;
484
512
485
- let update_fee = msgs:: UpdateFee {
486
- channel_id : chan. 2 ,
487
- feerate_per_kw : non_buffer_feerate + 4 ,
488
- } ;
513
+ let update_fee = msgs:: UpdateFee { channel_id : chan. 2 , feerate_per_kw : non_buffer_feerate + 4 } ;
489
514
490
515
nodes[ 1 ] . node . handle_update_fee ( node_a_id, & update_fee) ;
491
516
@@ -512,7 +537,8 @@ pub fn test_update_fee_that_saturates_subs() {
512
537
513
538
let chanmon_cfgs = create_chanmon_cfgs ( 2 ) ;
514
539
let node_cfgs = create_node_cfgs ( 2 , & chanmon_cfgs) ;
515
- let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ Some ( default_config. clone ( ) ) , Some ( default_config) ] ) ;
540
+ let node_chanmgrs =
541
+ create_node_chanmgrs ( 2 , & node_cfgs, & [ Some ( default_config. clone ( ) ) , Some ( default_config) ] ) ;
516
542
let mut nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
517
543
518
544
let node_a_id = nodes[ 0 ] . node . get_our_node_id ( ) ;
@@ -544,7 +570,8 @@ pub fn test_update_fee_that_saturates_subs() {
544
570
let mut per_peer_lock;
545
571
let mut peer_state_lock;
546
572
547
- let local_chan = get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , per_peer_lock, peer_state_lock, chan_id) ;
573
+ let local_chan =
574
+ get_channel_ref ! ( nodes[ 0 ] , nodes[ 1 ] , per_peer_lock, peer_state_lock, chan_id) ;
548
575
let local_chan_signer = local_chan. as_funded ( ) . unwrap ( ) . get_signer ( ) ;
549
576
let nondust_htlcs: Vec < HTLCOutputInCommitment > = vec ! [ ] ;
550
577
let commitment_tx = CommitmentTransaction :: new (
@@ -576,10 +603,7 @@ pub fn test_update_fee_that_saturates_subs() {
576
603
partial_signature_with_nonce : None ,
577
604
} ;
578
605
579
- let update_fee = msgs:: UpdateFee {
580
- channel_id : chan_id,
581
- feerate_per_kw : FEERATE ,
582
- } ;
606
+ let update_fee = msgs:: UpdateFee { channel_id : chan_id, feerate_per_kw : FEERATE } ;
583
607
584
608
nodes[ 1 ] . node . handle_update_fee ( node_a_id, & update_fee) ;
585
609
@@ -617,17 +641,19 @@ pub fn test_update_fee_with_fundee_update_add_htlc() {
617
641
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
618
642
assert_eq ! ( events_0. len( ) , 1 ) ;
619
643
let ( update_msg, commitment_signed) = match events_0[ 0 ] {
620
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
621
- ( update_fee. as_ref ( ) , commitment_signed)
622
- } ,
644
+ MessageSendEvent :: UpdateHTLCs {
645
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
646
+ ..
647
+ } => ( update_fee. as_ref ( ) , commitment_signed) ,
623
648
_ => panic ! ( "Unexpected event" ) ,
624
649
} ;
625
650
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_msg. unwrap ( ) ) ;
626
651
nodes[ 1 ] . node . handle_commitment_signed_batch_test ( node_a_id, commitment_signed) ;
627
652
let ( revoke_msg, commitment_signed) = get_revoke_commit_msgs ! ( nodes[ 1 ] , node_a_id) ;
628
653
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
629
654
630
- let ( route, our_payment_hash, our_payment_preimage, our_payment_secret) = get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 800000 ) ;
655
+ let ( route, our_payment_hash, our_payment_preimage, our_payment_secret) =
656
+ get_route_and_payment_hash ! ( nodes[ 1 ] , nodes[ 0 ] , 800000 ) ;
631
657
632
658
// nothing happens since node[1] is in AwaitingRemoteRevoke
633
659
let onion = RecipientOnionFields :: secret_only ( our_payment_secret) ;
@@ -658,7 +684,9 @@ pub fn test_update_fee_with_fundee_update_add_htlc() {
658
684
assert_eq ! ( commitment_update. update_fee. is_none( ) , true ) ;
659
685
660
686
nodes[ 0 ] . node . handle_update_add_htlc ( node_b_id, & commitment_update. update_add_htlcs [ 0 ] ) ;
661
- nodes[ 0 ] . node . handle_commitment_signed_batch_test ( node_b_id, & commitment_update. commitment_signed ) ;
687
+ nodes[ 0 ]
688
+ . node
689
+ . handle_commitment_signed_batch_test ( node_b_id, & commitment_update. commitment_signed ) ;
662
690
check_added_monitors ( & nodes[ 0 ] , 1 ) ;
663
691
let ( revoke, commitment_signed) = get_revoke_commit_msgs ! ( nodes[ 0 ] , node_b_id) ;
664
692
@@ -680,7 +708,7 @@ pub fn test_update_fee_with_fundee_update_add_htlc() {
680
708
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
681
709
assert_eq ! ( events. len( ) , 1 ) ;
682
710
match events[ 0 ] {
683
- Event :: PaymentClaimable { .. } => { } ,
711
+ Event :: PaymentClaimable { .. } => { } ,
684
712
_ => panic ! ( "Unexpected event" ) ,
685
713
} ;
686
714
@@ -735,9 +763,10 @@ pub fn test_update_fee() {
735
763
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
736
764
assert_eq ! ( events_0. len( ) , 1 ) ;
737
765
let ( update_msg, commitment_signed) = match events_0[ 0 ] {
738
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
739
- ( update_fee. as_ref ( ) , commitment_signed)
740
- } ,
766
+ MessageSendEvent :: UpdateHTLCs {
767
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
768
+ ..
769
+ } => ( update_fee. as_ref ( ) , commitment_signed) ,
741
770
_ => panic ! ( "Unexpected event" ) ,
742
771
} ;
743
772
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_msg. unwrap ( ) ) ;
@@ -762,9 +791,10 @@ pub fn test_update_fee() {
762
791
let events_0 = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
763
792
assert_eq ! ( events_0. len( ) , 1 ) ;
764
793
let ( update_msg, commitment_signed) = match events_0[ 0 ] {
765
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
766
- ( update_fee. as_ref ( ) , commitment_signed)
767
- } ,
794
+ MessageSendEvent :: UpdateHTLCs {
795
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
796
+ ..
797
+ } => ( update_fee. as_ref ( ) , commitment_signed) ,
768
798
_ => panic ! ( "Unexpected event" ) ,
769
799
} ;
770
800
@@ -797,7 +827,9 @@ pub fn test_update_fee() {
797
827
check_added_monitors ( & nodes[ 1 ] , 1 ) ;
798
828
799
829
// Deliver (7)
800
- nodes[ 0 ] . node . handle_commitment_signed_batch_test ( node_b_id, & commitment_update. commitment_signed ) ;
830
+ nodes[ 0 ]
831
+ . node
832
+ . handle_commitment_signed_batch_test ( node_b_id, & commitment_update. commitment_signed ) ;
801
833
check_added_monitors ( & nodes[ 0 ] , 1 ) ;
802
834
let revoke_msg = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendRevokeAndACK , node_b_id) ;
803
835
// No commitment_signed so get_event_msg's assert(len == 1) passes
@@ -834,22 +866,29 @@ pub fn test_chan_init_feerate_unaffordability() {
834
866
// Set the push_msat amount such that nodes[0] will not be able to afford to add even a single
835
867
// HTLC.
836
868
let mut push_amt = 100_000_000 ;
837
- push_amt -= commit_tx_fee_msat ( feerate_per_kw, MIN_AFFORDABLE_HTLC_COUNT as u64 , & channel_type_features) ;
869
+ push_amt -= commit_tx_fee_msat (
870
+ feerate_per_kw,
871
+ MIN_AFFORDABLE_HTLC_COUNT as u64 ,
872
+ & channel_type_features,
873
+ ) ;
838
874
assert_eq ! ( nodes[ 0 ] . node. create_channel( node_b_id, 100_000 , push_amt + 1 , 42 , None , None ) . unwrap_err( ) ,
839
875
APIError :: APIMisuseError { err: "Funding amount (356) can't even pay fee for initial commitment transaction fee of 357." . to_string( ) } ) ;
840
876
841
877
// During open, we don't have a "counterparty channel reserve" to check against, so that
842
878
// requirement only comes into play on the open_channel handling side.
843
879
push_amt -= get_holder_selected_channel_reserve_satoshis ( 100_000 , & default_config) * 1000 ;
844
880
nodes[ 0 ] . node . create_channel ( node_b_id, 100_000 , push_amt, 42 , None , None ) . unwrap ( ) ;
845
- let mut open_channel_msg = get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendOpenChannel , node_b_id) ;
881
+ let mut open_channel_msg =
882
+ get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendOpenChannel , node_b_id) ;
846
883
open_channel_msg. push_msat += 1 ;
847
884
nodes[ 1 ] . node . handle_open_channel ( node_a_id, & open_channel_msg) ;
848
885
849
886
let msg_events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
850
887
assert_eq ! ( msg_events. len( ) , 1 ) ;
851
888
match msg_events[ 0 ] {
852
- MessageSendEvent :: HandleError { action : ErrorAction :: SendErrorMessage { ref msg } , .. } => {
889
+ MessageSendEvent :: HandleError {
890
+ action : ErrorAction :: SendErrorMessage { ref msg } , ..
891
+ } => {
853
892
assert_eq ! ( msg. data, "Insufficient funding amount for initial reserve" ) ;
854
893
} ,
855
894
_ => panic ! ( "Unexpected event" ) ,
@@ -887,7 +926,10 @@ pub fn accept_busted_but_better_fee() {
887
926
let events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
888
927
assert_eq ! ( events. len( ) , 1 ) ;
889
928
match events[ 0 ] {
890
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
929
+ MessageSendEvent :: UpdateHTLCs {
930
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
931
+ ..
932
+ } => {
891
933
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_fee. as_ref ( ) . unwrap ( ) ) ;
892
934
commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , commitment_signed, false ) ;
893
935
} ,
@@ -906,7 +948,10 @@ pub fn accept_busted_but_better_fee() {
906
948
let events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
907
949
assert_eq ! ( events. len( ) , 1 ) ;
908
950
match events[ 0 ] {
909
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } , .. } => {
951
+ MessageSendEvent :: UpdateHTLCs {
952
+ updates : msgs:: CommitmentUpdate { ref update_fee, ref commitment_signed, .. } ,
953
+ ..
954
+ } => {
910
955
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_fee. as_ref ( ) . unwrap ( ) ) ;
911
956
commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , commitment_signed, false ) ;
912
957
} ,
@@ -925,7 +970,10 @@ pub fn accept_busted_but_better_fee() {
925
970
let events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
926
971
assert_eq ! ( events. len( ) , 1 ) ;
927
972
match events[ 0 ] {
928
- MessageSendEvent :: UpdateHTLCs { updates : msgs:: CommitmentUpdate { ref update_fee, .. } , .. } => {
973
+ MessageSendEvent :: UpdateHTLCs {
974
+ updates : msgs:: CommitmentUpdate { ref update_fee, .. } ,
975
+ ..
976
+ } => {
929
977
nodes[ 1 ] . node . handle_update_fee ( node_a_id, update_fee. as_ref ( ) . unwrap ( ) ) ;
930
978
let reason = ClosureReason :: PeerFeerateTooLow {
931
979
peer_feerate_sat_per_kw : 1000 ,
0 commit comments