@@ -485,6 +485,24 @@ pub struct ChannelConfig {
485
485
/// [`PaymentClaimable::counterparty_skimmed_fee_msat`]: crate::events::Event::PaymentClaimable::counterparty_skimmed_fee_msat
486
486
// TODO: link to bLIP when it's merged
487
487
pub accept_underpaying_htlcs : bool ,
488
+
489
+ /// When checking our channel counterparty's fee rate, we will allow any value that is up to the greater
490
+ /// between [`ChannelConfig::base_max_accepted_fee_rate`] and [`ChannelConfig::max_accepted_fee_rate_multiplier`]
491
+ /// times our [`HighPriority`] estimated feerate. This is only used for non-anchor channels.
492
+ ///
493
+ /// Default value: 25 sat/vbyte.
494
+ ///
495
+ /// [`HighPriority`]: crate::chain::chaininterface::ConfirmationTarget::HighPriority
496
+ pub base_max_accepted_fee_rate : u32 ,
497
+
498
+ /// When checking our channel counterparty's fee rate, we will allow any value that is up to the greater
499
+ /// between [`ChannelConfig::base_max_accepted_fee_rate`] and [`ChannelConfig::max_accepted_fee_rate_multiplier`]
500
+ /// times our [`HighPriority`] estimated feerate. This is only used for non-anchor channels.
501
+ ///
502
+ /// Default value: 10.
503
+ ///
504
+ /// [`HighPriority`]: crate::chain::chaininterface::ConfirmationTarget::HighPriority
505
+ pub max_accepted_fee_rate_multiplier : u32 ,
488
506
}
489
507
490
508
impl ChannelConfig {
@@ -518,6 +536,8 @@ impl Default for ChannelConfig {
518
536
max_dust_htlc_exposure : MaxDustHTLCExposure :: FeeRateMultiplier ( 5000 ) ,
519
537
force_close_avoidance_max_fee_satoshis : 1000 ,
520
538
accept_underpaying_htlcs : false ,
539
+ base_max_accepted_fee_rate : 25 * 250 , // 25 sat/vbyte
540
+ max_accepted_fee_rate_multiplier : 10 ,
521
541
}
522
542
}
523
543
}
@@ -539,6 +559,8 @@ impl crate::util::ser::Writeable for ChannelConfig {
539
559
// LegacyChannelConfig. To make sure that serialization is not compatible with this one, we use
540
560
// the next required type of 10, which if seen by the old serialization will always fail.
541
561
( 10 , self . force_close_avoidance_max_fee_satoshis, required) ,
562
+ ( 11 , self . base_max_accepted_fee_rate, required) ,
563
+ ( 13 , self . max_accepted_fee_rate_multiplier, required) ,
542
564
} ) ;
543
565
Ok ( ( ) )
544
566
}
@@ -553,6 +575,8 @@ impl crate::util::ser::Readable for ChannelConfig {
553
575
let mut max_dust_htlc_exposure_msat = None ;
554
576
let mut max_dust_htlc_exposure_enum = None ;
555
577
let mut force_close_avoidance_max_fee_satoshis = 1000 ;
578
+ let mut base_max_accepted_fee_rate = 25 * 250 ;
579
+ let mut max_accepted_fee_rate_multiplier = 10 ;
556
580
read_tlv_fields ! ( reader, {
557
581
( 0 , forwarding_fee_proportional_millionths, required) ,
558
582
( 1 , accept_underpaying_htlcs, ( default_value, false ) ) ,
@@ -562,6 +586,8 @@ impl crate::util::ser::Readable for ChannelConfig {
562
586
// Has always been written, but became optionally read in 0.0.116
563
587
( 6 , max_dust_htlc_exposure_msat, option) ,
564
588
( 10 , force_close_avoidance_max_fee_satoshis, required) ,
589
+ ( 11 , base_max_accepted_fee_rate, ( default_value, 25 * 250 as u32 ) ) ,
590
+ ( 13 , max_accepted_fee_rate_multiplier, ( default_value, 10_u32 ) ) ,
565
591
} ) ;
566
592
let max_dust_htlc_fixed_limit = max_dust_htlc_exposure_msat. unwrap_or ( 5_000_000 ) ;
567
593
let max_dust_htlc_exposure_msat = max_dust_htlc_exposure_enum
@@ -573,6 +599,8 @@ impl crate::util::ser::Readable for ChannelConfig {
573
599
cltv_expiry_delta,
574
600
max_dust_htlc_exposure : max_dust_htlc_exposure_msat,
575
601
force_close_avoidance_max_fee_satoshis,
602
+ base_max_accepted_fee_rate,
603
+ max_accepted_fee_rate_multiplier,
576
604
} )
577
605
}
578
606
}
@@ -666,6 +694,8 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
666
694
let mut commit_upfront_shutdown_pubkey = false ;
667
695
let mut forwarding_fee_base_msat = 0 ;
668
696
let mut max_dust_htlc_exposure_enum = None ;
697
+ let mut base_max_accepted_fee_rate = 25 * 250 ;
698
+ let mut max_accepted_fee_rate_multiplier = 10 ;
669
699
read_tlv_fields ! ( reader, {
670
700
( 0 , forwarding_fee_proportional_millionths, required) ,
671
701
// Has always been written, but became optionally read in 0.0.116
@@ -676,6 +706,8 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
676
706
( 5 , max_dust_htlc_exposure_enum, option) ,
677
707
( 6 , commit_upfront_shutdown_pubkey, required) ,
678
708
( 8 , forwarding_fee_base_msat, required) ,
709
+ ( 11 , base_max_accepted_fee_rate, ( default_value, 25 * 250 as u32 ) ) ,
710
+ ( 13 , max_accepted_fee_rate_multiplier, ( default_value, 10_u32 ) ) ,
679
711
} ) ;
680
712
let max_dust_htlc_exposure_msat_fixed_limit =
681
713
max_dust_htlc_exposure_msat_fixed_limit. unwrap_or ( 5_000_000 ) ;
@@ -689,6 +721,8 @@ impl crate::util::ser::Readable for LegacyChannelConfig {
689
721
force_close_avoidance_max_fee_satoshis,
690
722
forwarding_fee_base_msat,
691
723
accept_underpaying_htlcs : false ,
724
+ base_max_accepted_fee_rate,
725
+ max_accepted_fee_rate_multiplier,
692
726
} ,
693
727
announced_channel,
694
728
commit_upfront_shutdown_pubkey,
0 commit comments