@@ -370,8 +370,8 @@ impl OnchainEventEntry {
370
370
conf_threshold
371
371
}
372
372
373
- fn has_reached_confirmation_threshold ( & self , height : u32 ) -> bool {
374
- height >= self . confirmation_threshold ( )
373
+ fn has_reached_confirmation_threshold ( & self , best_block : & BestBlock ) -> bool {
374
+ best_block . height ( ) >= self . confirmation_threshold ( )
375
375
}
376
376
}
377
377
@@ -1856,7 +1856,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
1856
1856
} else if htlc. 0 . cltv_expiry > self . best_block . height ( ) + 1 {
1857
1857
// Don't broadcast HTLC-Timeout transactions immediately as they don't meet the
1858
1858
// current locktime requirements on-chain. We will broadcast them in
1859
- // `block_confirmed` when `would_broadcast_at_height ` returns true.
1859
+ // `block_confirmed` when `should_broadcast ` returns true.
1860
1860
// Note that we add + 1 as transactions are broadcastable when they can be
1861
1861
// confirmed in the next block.
1862
1862
continue ;
@@ -2033,7 +2033,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2033
2033
F :: Target : FeeEstimator ,
2034
2034
L :: Target : Logger ,
2035
2035
{
2036
- let should_broadcast = self . would_broadcast_at_height ( self . best_block . height ( ) , logger) ;
2036
+ let should_broadcast = self . should_broadcast ( logger) ;
2037
2037
if should_broadcast {
2038
2038
let funding_outp = HolderFundingOutput :: build ( self . funding_redeemscript . clone ( ) ) ;
2039
2039
let commitment_package = PackageTemplate :: build_package ( self . funding_info . 0 . txid . clone ( ) , self . funding_info . 0 . index as u32 , PackageSolvingData :: HolderFundingOutput ( funding_outp) , self . best_block . height ( ) , false , self . best_block . height ( ) ) ;
@@ -2054,7 +2054,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2054
2054
self . onchain_events_awaiting_threshold_conf . drain ( ..) . collect :: < Vec < _ > > ( ) ;
2055
2055
let mut onchain_events_reaching_threshold_conf = Vec :: new ( ) ;
2056
2056
for entry in onchain_events_awaiting_threshold_conf {
2057
- if entry. has_reached_confirmation_threshold ( self . best_block . height ( ) ) {
2057
+ if entry. has_reached_confirmation_threshold ( & self . best_block ) {
2058
2058
onchain_events_reaching_threshold_conf. push ( entry) ;
2059
2059
} else {
2060
2060
self . onchain_events_awaiting_threshold_conf . push ( entry) ;
@@ -2211,7 +2211,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2211
2211
false
2212
2212
}
2213
2213
2214
- fn would_broadcast_at_height < L : Deref > ( & self , height : u32 , logger : & L ) -> bool where L :: Target : Logger {
2214
+ fn should_broadcast < L : Deref > ( & self , logger : & L ) -> bool where L :: Target : Logger {
2215
2215
// We need to consider all HTLCs which are:
2216
2216
// * in any unrevoked counterparty commitment transaction, as they could broadcast said
2217
2217
// transactions and we'd end up in a race, or
@@ -2222,6 +2222,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2222
2222
// to the source, and if we don't fail the channel we will have to ensure that the next
2223
2223
// updates that peer sends us are update_fails, failing the channel if not. It's probably
2224
2224
// easier to just fail the channel as this case should be rare enough anyway.
2225
+ let height = self . best_block . height ( ) ;
2225
2226
macro_rules! scan_commitment {
2226
2227
( $htlcs: expr, $holder_tx: expr) => {
2227
2228
for ref htlc in $htlcs {
0 commit comments