@@ -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 ;
@@ -2035,7 +2035,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2035
2035
F :: Target : FeeEstimator ,
2036
2036
L :: Target : Logger ,
2037
2037
{
2038
- let should_broadcast = self . would_broadcast_at_height ( self . best_block . height ( ) , logger) ;
2038
+ let should_broadcast = self . should_broadcast ( 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) ;
@@ -2214,7 +2214,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2214
2214
false
2215
2215
}
2216
2216
2217
- fn would_broadcast_at_height < L : Deref > ( & self , height : u32 , logger : & L ) -> bool where L :: Target : Logger {
2217
+ fn should_broadcast < L : Deref > ( & self , logger : & L ) -> bool where L :: Target : Logger {
2218
2218
// We need to consider all HTLCs which are:
2219
2219
// * in any unrevoked counterparty commitment transaction, as they could broadcast said
2220
2220
// transactions and we'd end up in a race, or
@@ -2225,6 +2225,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
2225
2225
// to the source, and if we don't fail the channel we will have to ensure that the next
2226
2226
// updates that peer sends us are update_fails, failing the channel if not. It's probably
2227
2227
// easier to just fail the channel as this case should be rare enough anyway.
2228
+ let height = self . best_block . height ( ) ;
2228
2229
macro_rules! scan_commitment {
2229
2230
( $htlcs: expr, $holder_tx: expr) => {
2230
2231
for ref htlc in $htlcs {
0 commit comments