Skip to content

Commit 8701b1b

Browse files
authored
Merge pull request #3003 from TheBlueMatt/2024-04-2964-followups
#2964 Followups
2 parents dfb250b + fd0c3e4 commit 8701b1b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lightning/src/chain/channelmonitor.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
18651865
/// its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set).
18661866
///
18671867
/// This function returns true only if [`Self::get_claimable_balances`] has been empty for at least
1868-
/// 2016 blocks as an additional protection against any bugs resulting in spuriously empty balance sets.
1868+
/// 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets.
18691869
pub fn is_fully_resolved<L: Logger>(&self, logger: &L) -> bool {
18701870
let mut is_all_funds_claimed = self.get_claimable_balances().is_empty();
18711871
let current_height = self.current_best_block().height;
@@ -1878,10 +1878,10 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
18781878
}
18791879
}
18801880

1881+
const BLOCKS_THRESHOLD: u32 = 4032; // ~four weeks
18811882
match (inner.balances_empty_height, is_all_funds_claimed) {
18821883
(Some(balances_empty_height), true) => {
18831884
// Claimed all funds, check if reached the blocks threshold.
1884-
const BLOCKS_THRESHOLD: u32 = 4032; // ~four weeks
18851885
return current_height >= balances_empty_height + BLOCKS_THRESHOLD;
18861886
},
18871887
(Some(_), false) => {
@@ -1897,6 +1897,9 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
18971897
(None, true) => {
18981898
// Claimed all funds but `balances_empty_height` is None. It is set to the
18991899
// current block height.
1900+
log_debug!(logger,
1901+
"ChannelMonitor funded at {} is now fully resolved. It will become archivable in {} blocks",
1902+
inner.get_funding_txo().0, BLOCKS_THRESHOLD);
19001903
inner.balances_empty_height = Some(current_height);
19011904
false
19021905
},

0 commit comments

Comments
 (0)