@@ -126,25 +126,38 @@ where
126126 ] ;
127127 for target in confirmation_targets {
128128 let num_blocks = match target {
129- ConfirmationTarget :: OnChainSweep => 3 ,
129+ ConfirmationTarget :: OnChainSweep => 6 ,
130130 ConfirmationTarget :: MaxAllowedNonAnchorChannelRemoteFee => 1 ,
131131 ConfirmationTarget :: MinAllowedAnchorChannelRemoteFee => 1008 ,
132- ConfirmationTarget :: MinAllowedNonAnchorChannelRemoteFee => 12 ,
133- ConfirmationTarget :: AnchorChannelFee => 12 ,
134- ConfirmationTarget :: NonAnchorChannelFee => 6 ,
135- ConfirmationTarget :: ChannelCloseMinimum => 12 ,
132+ ConfirmationTarget :: MinAllowedNonAnchorChannelRemoteFee => 144 ,
133+ ConfirmationTarget :: AnchorChannelFee => 1008 ,
134+ ConfirmationTarget :: NonAnchorChannelFee => 12 ,
135+ ConfirmationTarget :: ChannelCloseMinimum => 144 ,
136136 } ;
137137
138138 let est_fee_rate = self . blockchain . estimate_fee ( num_blocks) . await ;
139139
140140 match est_fee_rate {
141141 Ok ( rate) => {
142- locked_fee_rate_cache. insert ( target, rate) ;
142+ // LDK 0.0.118 introduced changes to the `ConfirmationTarget` semantics that
143+ // require some post-estimation adjustments to the fee rates, which we do here.
144+ let adjusted_fee_rate = match target {
145+ ConfirmationTarget :: MaxAllowedNonAnchorChannelRemoteFee => {
146+ let really_high_prio = rate. as_sat_per_vb ( ) * 10.0 ;
147+ FeeRate :: from_sat_per_vb ( really_high_prio)
148+ }
149+ ConfirmationTarget :: MinAllowedNonAnchorChannelRemoteFee => {
150+ let slightly_less_than_background = rate. fee_wu ( 1000 ) - 250 ;
151+ FeeRate :: from_sat_per_kwu ( slightly_less_than_background as f32 )
152+ }
153+ _ => rate,
154+ } ;
155+ locked_fee_rate_cache. insert ( target, adjusted_fee_rate) ;
143156 log_trace ! (
144157 self . logger,
145158 "Fee rate estimation updated for {:?}: {} sats/kwu" ,
146159 target,
147- rate . fee_wu( 1000 )
160+ adjusted_fee_rate . fee_wu( 1000 )
148161 ) ;
149162 }
150163 Err ( e) => {
0 commit comments