File tree 4 files changed +16
-13
lines changed
4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ pub enum ConfirmationTarget {
68
68
/// A trait which should be implemented to provide feerate information on a number of time
69
69
/// horizons.
70
70
///
71
+ /// If access to a local mempool is not feasible, feerate estimates should be fetched from a set of
72
+ /// third-parties hosting them. Note that this enables them to affect the propagation of your
73
+ /// pre-signed transactions at any time and therefore endangers the safety of channels funds. It
74
+ /// should be considered carefully as a deployment.
75
+ ///
71
76
/// Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
72
77
/// called from inside the library in response to chain events, P2P events, or timer events).
73
78
pub trait FeeEstimator {
Original file line number Diff line number Diff line change @@ -633,11 +633,12 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
633
633
. compute_package_feerate ( fee_estimator, conf_target, force_feerate_bump) ;
634
634
if let Some ( input_amount_sat) = output. funding_amount {
635
635
let fee_sat = input_amount_sat - tx. output . iter ( ) . map ( |output| output. value ) . sum :: < u64 > ( ) ;
636
- if compute_feerate_sat_per_1000_weight ( fee_sat, tx. weight ( ) as u64 ) >=
637
- package_target_feerate_sat_per_1000_weight
638
- {
639
- log_debug ! ( logger, "Commitment transaction {} already meets required feerate {} sat/kW" ,
640
- tx. txid( ) , package_target_feerate_sat_per_1000_weight) ;
636
+ let commitment_tx_feerate_sat_per_1000_weight =
637
+ compute_feerate_sat_per_1000_weight ( fee_sat, tx. weight ( ) as u64 ) ;
638
+ if commitment_tx_feerate_sat_per_1000_weight >= package_target_feerate_sat_per_1000_weight {
639
+ log_debug ! ( logger, "Pre-signed {} already has feerate {} sat/kW above required {} sat/kW" ,
640
+ log_tx!( tx) , commitment_tx_feerate_sat_per_1000_weight,
641
+ package_target_feerate_sat_per_1000_weight) ;
641
642
return Some ( ( new_timer, 0 , OnchainClaim :: Tx ( tx. clone ( ) ) ) ) ;
642
643
}
643
644
}
Original file line number Diff line number Diff line change @@ -173,18 +173,15 @@ impl<'a> core::fmt::Display for DebugBytes<'a> {
173
173
///
174
174
/// This is not exported to bindings users as fmt can't be used in C
175
175
#[ doc( hidden) ]
176
- pub struct DebugIter < T : fmt:: Display , I : core:: iter:: Iterator < Item = T > + Clone > ( pub core :: cell :: RefCell < I > ) ;
176
+ pub struct DebugIter < T : fmt:: Display , I : core:: iter:: Iterator < Item = T > + Clone > ( pub I ) ;
177
177
impl < T : fmt:: Display , I : core:: iter:: Iterator < Item = T > + Clone > fmt:: Display for DebugIter < T , I > {
178
178
fn fmt ( & self , f : & mut fmt:: Formatter ) -> Result < ( ) , fmt:: Error > {
179
- use core:: ops:: DerefMut ;
180
179
write ! ( f, "[" ) ?;
181
- let iter_ref = self . 0 . clone ( ) ;
182
- let mut iter = iter_ref. borrow_mut ( ) ;
183
- for item in iter. deref_mut ( ) {
180
+ let mut iter = self . 0 . clone ( ) ;
181
+ if let Some ( item) = iter. next ( ) {
184
182
write ! ( f, "{}" , item) ?;
185
- break ;
186
183
}
187
- for item in iter. deref_mut ( ) {
184
+ while let Some ( item) = iter. next ( ) {
188
185
write ! ( f, ", {}" , item) ?;
189
186
}
190
187
write ! ( f, "]" ) ?;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use crate::util::logger::DebugBytes;
19
19
20
20
macro_rules! log_iter {
21
21
( $obj: expr) => {
22
- $crate:: util:: logger:: DebugIter ( core :: cell :: RefCell :: new ( $obj) )
22
+ $crate:: util:: logger:: DebugIter ( $obj)
23
23
}
24
24
}
25
25
You can’t perform that action at this time.
0 commit comments