@@ -75,10 +75,23 @@ impl BitcoindClient {
7575 "Failed to make initial call to bitcoind - please check your RPC user/password and access settings" )
7676 } ) ?;
7777 let mut fees: HashMap < ConfirmationTarget , AtomicU32 > = HashMap :: new ( ) ;
78- fees. insert ( ConfirmationTarget :: MempoolMinimum , AtomicU32 :: new ( MIN_FEERATE ) ) ;
79- fees. insert ( ConfirmationTarget :: Background , AtomicU32 :: new ( MIN_FEERATE ) ) ;
80- fees. insert ( ConfirmationTarget :: Normal , AtomicU32 :: new ( 2000 ) ) ;
81- fees. insert ( ConfirmationTarget :: HighPriority , AtomicU32 :: new ( 5000 ) ) ;
78+ fees. insert ( ConfirmationTarget :: OnChainSweep , AtomicU32 :: new ( 5000 ) ) ;
79+ fees. insert (
80+ ConfirmationTarget :: MaxAllowedNonAnchorChannelRemoteFee ,
81+ AtomicU32 :: new ( 25 * 250 ) ,
82+ ) ;
83+ fees. insert (
84+ ConfirmationTarget :: MinAllowedAnchorChannelRemoteFee ,
85+ AtomicU32 :: new ( MIN_FEERATE ) ,
86+ ) ;
87+ fees. insert (
88+ ConfirmationTarget :: MinAllowedNonAnchorChannelRemoteFee ,
89+ AtomicU32 :: new ( MIN_FEERATE ) ,
90+ ) ;
91+ fees. insert ( ConfirmationTarget :: AnchorChannelFee , AtomicU32 :: new ( MIN_FEERATE ) ) ;
92+ fees. insert ( ConfirmationTarget :: NonAnchorChannelFee , AtomicU32 :: new ( 2000 ) ) ;
93+ fees. insert ( ConfirmationTarget :: ChannelCloseMinimum , AtomicU32 :: new ( MIN_FEERATE ) ) ;
94+
8295 let client = Self {
8396 bitcoind_rpc_client : Arc :: new ( bitcoind_rpc_client) ,
8497 host,
@@ -162,18 +175,28 @@ impl BitcoindClient {
162175 }
163176 } ;
164177
165- fees. get ( & ConfirmationTarget :: MempoolMinimum )
178+ fees. get ( & ConfirmationTarget :: OnChainSweep )
179+ . unwrap ( )
180+ . store ( high_prio_estimate, Ordering :: Release ) ;
181+ fees. get ( & ConfirmationTarget :: MaxAllowedNonAnchorChannelRemoteFee )
182+ . unwrap ( )
183+ . store ( std:: cmp:: max ( 25 * 250 , high_prio_estimate * 10 ) , Ordering :: Release ) ;
184+ fees. get ( & ConfirmationTarget :: MinAllowedAnchorChannelRemoteFee )
166185 . unwrap ( )
167186 . store ( mempoolmin_estimate, Ordering :: Release ) ;
168- fees. get ( & ConfirmationTarget :: Background )
187+ fees. get ( & ConfirmationTarget :: MinAllowedNonAnchorChannelRemoteFee )
188+ . unwrap ( )
189+ . store ( background_estimate - 250 , Ordering :: Release ) ;
190+ fees. get ( & ConfirmationTarget :: AnchorChannelFee )
169191 . unwrap ( )
170192 . store ( background_estimate, Ordering :: Release ) ;
171- fees. get ( & ConfirmationTarget :: Normal )
193+ fees. get ( & ConfirmationTarget :: NonAnchorChannelFee )
172194 . unwrap ( )
173195 . store ( normal_estimate, Ordering :: Release ) ;
174- fees. get ( & ConfirmationTarget :: HighPriority )
196+ fees. get ( & ConfirmationTarget :: ChannelCloseMinimum )
175197 . unwrap ( )
176- . store ( high_prio_estimate, Ordering :: Release ) ;
198+ . store ( background_estimate, Ordering :: Release ) ;
199+
177200 tokio:: time:: sleep ( Duration :: from_secs ( 60 ) ) . await ;
178201 }
179202 } ) ;
@@ -203,7 +226,8 @@ impl BitcoindClient {
203226 // LDK gives us feerates in satoshis per KW but Bitcoin Core here expects fees
204227 // denominated in satoshis per vB. First we need to multiply by 4 to convert weight
205228 // units to virtual bytes, then divide by 1000 to convert KvB to vB.
206- "fee_rate" : self . get_est_sat_per_1000_weight( ConfirmationTarget :: Normal ) as f64 / 250.0 ,
229+ "fee_rate" : self
230+ . get_est_sat_per_1000_weight( ConfirmationTarget :: NonAnchorChannelFee ) as f64 / 250.0 ,
207231 // While users could "cancel" a channel open by RBF-bumping and paying back to
208232 // themselves, we don't allow it here as its easy to have users accidentally RBF bump
209233 // and pay to the channel funding address, which results in loss of funds. Real
0 commit comments