1
- #![ cfg_attr( rustfmt, rustfmt_skip) ]
2
-
3
1
// This file is Copyright its original authors, visible in version control
4
2
// history.
5
3
//
@@ -189,25 +187,29 @@ pub const FEERATE_FLOOR_SATS_PER_KW: u32 = 253;
189
187
///
190
188
/// Note that this does *not* implement [`FeeEstimator`] to make it harder to accidentally mix the
191
189
/// two.
192
- pub ( crate ) struct LowerBoundedFeeEstimator < F : Deref > ( pub F ) where F :: Target : FeeEstimator ;
193
-
194
- impl < F : Deref > LowerBoundedFeeEstimator < F > where F :: Target : FeeEstimator {
190
+ pub ( crate ) struct LowerBoundedFeeEstimator < F : Deref > ( pub F )
191
+ where
192
+ F :: Target : FeeEstimator ;
193
+
194
+ impl < F : Deref > LowerBoundedFeeEstimator < F >
195
+ where
196
+ F :: Target : FeeEstimator ,
197
+ {
195
198
/// Creates a new `LowerBoundedFeeEstimator` which wraps the provided fee_estimator
196
199
pub fn new ( fee_estimator : F ) -> Self {
197
200
LowerBoundedFeeEstimator ( fee_estimator)
198
201
}
199
202
200
203
pub fn bounded_sat_per_1000_weight ( & self , confirmation_target : ConfirmationTarget ) -> u32 {
201
- cmp:: max (
202
- self . 0 . get_est_sat_per_1000_weight ( confirmation_target) ,
203
- FEERATE_FLOOR_SATS_PER_KW ,
204
- )
204
+ cmp:: max ( self . 0 . get_est_sat_per_1000_weight ( confirmation_target) , FEERATE_FLOOR_SATS_PER_KW )
205
205
}
206
206
}
207
207
208
208
#[ cfg( test) ]
209
209
mod tests {
210
- use super :: { FEERATE_FLOOR_SATS_PER_KW , LowerBoundedFeeEstimator , ConfirmationTarget , FeeEstimator } ;
210
+ use super :: {
211
+ ConfirmationTarget , FeeEstimator , LowerBoundedFeeEstimator , FEERATE_FLOOR_SATS_PER_KW ,
212
+ } ;
211
213
212
214
struct TestFeeEstimator {
213
215
sat_per_kw : u32 ,
@@ -225,7 +227,10 @@ mod tests {
225
227
let test_fee_estimator = & TestFeeEstimator { sat_per_kw } ;
226
228
let fee_estimator = LowerBoundedFeeEstimator :: new ( test_fee_estimator) ;
227
229
228
- assert_eq ! ( fee_estimator. bounded_sat_per_1000_weight( ConfirmationTarget :: AnchorChannelFee ) , FEERATE_FLOOR_SATS_PER_KW ) ;
230
+ assert_eq ! (
231
+ fee_estimator. bounded_sat_per_1000_weight( ConfirmationTarget :: AnchorChannelFee ) ,
232
+ FEERATE_FLOOR_SATS_PER_KW
233
+ ) ;
229
234
}
230
235
231
236
#[ test]
@@ -234,6 +239,9 @@ mod tests {
234
239
let test_fee_estimator = & TestFeeEstimator { sat_per_kw } ;
235
240
let fee_estimator = LowerBoundedFeeEstimator :: new ( test_fee_estimator) ;
236
241
237
- assert_eq ! ( fee_estimator. bounded_sat_per_1000_weight( ConfirmationTarget :: AnchorChannelFee ) , sat_per_kw) ;
242
+ assert_eq ! (
243
+ fee_estimator. bounded_sat_per_1000_weight( ConfirmationTarget :: AnchorChannelFee ) ,
244
+ sat_per_kw
245
+ ) ;
238
246
}
239
247
}
0 commit comments