@@ -75,10 +75,23 @@ impl BitcoindClient {
75
75
"Failed to make initial call to bitcoind - please check your RPC user/password and access settings" )
76
76
} ) ?;
77
77
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
+
82
95
let client = Self {
83
96
bitcoind_rpc_client : Arc :: new ( bitcoind_rpc_client) ,
84
97
host,
@@ -162,18 +175,28 @@ impl BitcoindClient {
162
175
}
163
176
} ;
164
177
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 )
166
185
. unwrap ( )
167
186
. 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 )
169
191
. unwrap ( )
170
192
. store ( background_estimate, Ordering :: Release ) ;
171
- fees. get ( & ConfirmationTarget :: Normal )
193
+ fees. get ( & ConfirmationTarget :: NonAnchorChannelFee )
172
194
. unwrap ( )
173
195
. store ( normal_estimate, Ordering :: Release ) ;
174
- fees. get ( & ConfirmationTarget :: HighPriority )
196
+ fees. get ( & ConfirmationTarget :: ChannelCloseMinimum )
175
197
. unwrap ( )
176
- . store ( high_prio_estimate, Ordering :: Release ) ;
198
+ . store ( background_estimate, Ordering :: Release ) ;
199
+
177
200
tokio:: time:: sleep ( Duration :: from_secs ( 60 ) ) . await ;
178
201
}
179
202
} ) ;
@@ -203,7 +226,8 @@ impl BitcoindClient {
203
226
// LDK gives us feerates in satoshis per KW but Bitcoin Core here expects fees
204
227
// denominated in satoshis per vB. First we need to multiply by 4 to convert weight
205
228
// 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 ,
207
231
// While users could "cancel" a channel open by RBF-bumping and paying back to
208
232
// themselves, we don't allow it here as its easy to have users accidentally RBF bump
209
233
// and pay to the channel funding address, which results in loss of funds. Real
0 commit comments