File tree Expand file tree Collapse file tree 4 files changed +16
-13
lines changed
Expand file tree Collapse file tree 4 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,11 @@ pub enum ConfirmationTarget {
6868/// A trait which should be implemented to provide feerate information on a number of time
6969/// horizons.
7070///
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+ ///
7176/// Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
7277/// called from inside the library in response to chain events, P2P events, or timer events).
7378pub trait FeeEstimator {
Original file line number Diff line number Diff line change @@ -633,11 +633,12 @@ impl<ChannelSigner: WriteableEcdsaChannelSigner> OnchainTxHandler<ChannelSigner>
633633 . compute_package_feerate ( fee_estimator, conf_target, force_feerate_bump) ;
634634 if let Some ( input_amount_sat) = output. funding_amount {
635635 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) ;
641642 return Some ( ( new_timer, 0 , OnchainClaim :: Tx ( tx. clone ( ) ) ) ) ;
642643 }
643644 }
Original file line number Diff line number Diff line change @@ -173,18 +173,15 @@ impl<'a> core::fmt::Display for DebugBytes<'a> {
173173///
174174/// This is not exported to bindings users as fmt can't be used in C
175175#[ 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 ) ;
177177impl < T : fmt:: Display , I : core:: iter:: Iterator < Item = T > + Clone > fmt:: Display for DebugIter < T , I > {
178178 fn fmt ( & self , f : & mut fmt:: Formatter ) -> Result < ( ) , fmt:: Error > {
179- use core:: ops:: DerefMut ;
180179 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 ( ) {
184182 write ! ( f, "{}" , item) ?;
185- break ;
186183 }
187- for item in iter. deref_mut ( ) {
184+ while let Some ( item) = iter. next ( ) {
188185 write ! ( f, ", {}" , item) ?;
189186 }
190187 write ! ( f, "]" ) ?;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ use crate::util::logger::DebugBytes;
1919
2020macro_rules! log_iter {
2121 ( $obj: expr) => {
22- $crate:: util:: logger:: DebugIter ( core :: cell :: RefCell :: new ( $obj) )
22+ $crate:: util:: logger:: DebugIter ( $obj)
2323 }
2424}
2525
You can’t perform that action at this time.
0 commit comments