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