@@ -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_holder_commitment_txn ` 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 ;
@@ -2035,7 +2035,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2035
2035
{
2036
2036
debug_assert ! ( self . best_block. height( ) >= conf_height) ;
2037
2037
2038
- let should_broadcast = self . would_broadcast_at_height ( self . best_block . height ( ) , logger) ;
2038
+ let should_broadcast = self . should_broadcast_holder_commitment_txn ( logger) ;
2039
2039
if should_broadcast {
2040
2040
let funding_outp = HolderFundingOutput :: build ( self . funding_redeemscript . clone ( ) ) ;
2041
2041
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 ( ) ) ;
@@ -2056,7 +2056,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2056
2056
self . onchain_events_awaiting_threshold_conf . drain ( ..) . collect :: < Vec < _ > > ( ) ;
2057
2057
let mut onchain_events_reaching_threshold_conf = Vec :: new ( ) ;
2058
2058
for entry in onchain_events_awaiting_threshold_conf {
2059
- if entry. has_reached_confirmation_threshold ( self . best_block . height ( ) ) {
2059
+ if entry. has_reached_confirmation_threshold ( & self . best_block ) {
2060
2060
onchain_events_reaching_threshold_conf. push ( entry) ;
2061
2061
} else {
2062
2062
self . onchain_events_awaiting_threshold_conf . push ( entry) ;
@@ -2213,7 +2213,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2213
2213
false
2214
2214
}
2215
2215
2216
- fn would_broadcast_at_height < L : Deref > ( & self , height : u32 , logger : & L ) -> bool where L :: Target : Logger {
2216
+ fn should_broadcast_holder_commitment_txn < L : Deref > ( & self , logger : & L ) -> bool where L :: Target : Logger {
2217
2217
// We need to consider all HTLCs which are:
2218
2218
// * in any unrevoked counterparty commitment transaction, as they could broadcast said
2219
2219
// transactions and we'd end up in a race, or
@@ -2224,6 +2224,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2224
2224
// to the source, and if we don't fail the channel we will have to ensure that the next
2225
2225
// updates that peer sends us are update_fails, failing the channel if not. It's probably
2226
2226
// easier to just fail the channel as this case should be rare enough anyway.
2227
+ let height = self . best_block . height ( ) ;
2227
2228
macro_rules! scan_commitment {
2228
2229
( $htlcs: expr, $holder_tx: expr) => {
2229
2230
for ref htlc in $htlcs {
0 commit comments