@@ -454,8 +454,8 @@ pub(super) struct Channel<Signer: Sign> {
454
454
/// closing_signed message and handling it in `maybe_propose_closing_signed`.
455
455
pending_counterparty_closing_signed : Option < msgs:: ClosingSigned > ,
456
456
457
- /// The minimum and maximum absolute fee we are willing to place on the closing transaction.
458
- /// These are set once we reach `closing_negotiation_ready`.
457
+ /// The minimum and maximum absolute fee, in satoshis, we are willing to place on the closing
458
+ /// transaction. These are set once we reach `closing_negotiation_ready`.
459
459
#[ cfg( test) ]
460
460
pub ( crate ) closing_fee_limits : Option < ( u64 , u64 ) > ,
461
461
#[ cfg( not( test) ) ]
@@ -3414,7 +3414,7 @@ impl<Signer: Sign> Channel<Signer> {
3414
3414
cmp:: max ( normal_feerate as u64 * tx_weight / 1000 + self . config . force_close_avoidance_max_fee_satoshis ,
3415
3415
proposed_max_feerate as u64 * tx_weight / 1000 )
3416
3416
} else {
3417
- u64 :: max_value ( )
3417
+ self . channel_value_satoshis - ( self . value_to_self_msat + 999 ) / 1000
3418
3418
} ;
3419
3419
3420
3420
self . closing_fee_limits = Some ( ( proposed_total_fee_satoshis, proposed_max_total_fee_satoshis) ) ;
@@ -3701,7 +3701,8 @@ impl<Signer: Sign> Channel<Signer> {
3701
3701
3702
3702
if !self . is_outbound ( ) {
3703
3703
// They have to pay, so pick the highest fee in the overlapping range.
3704
- debug_assert_eq ! ( our_max_fee, u64 :: max_value( ) ) ; // We should never set an upper bound
3704
+ // We should never set an upper bound aside from their full balance
3705
+ debug_assert_eq ! ( our_max_fee, self . channel_value_satoshis - ( self . value_to_self_msat + 999 ) / 1000 ) ;
3705
3706
propose_fee ! ( cmp:: min( max_fee_satoshis, our_max_fee) ) ;
3706
3707
} else {
3707
3708
if msg. fee_satoshis < our_min_fee || msg. fee_satoshis > our_max_fee {
0 commit comments