Skip to content

Commit 259815f

Browse files
committed
Fix bogus matching of pending spendable outputs of HTLCs based on HTLC transaction output index
1 parent 119668a commit 259815f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,8 +1739,12 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitorImpl<Signer> {
17391739
htlc_spend_pending = Some((event.confirmation_threshold(), preimage.is_some()));
17401740
},
17411741
OnchainEvent::MaturingOutput {
1742-
descriptor: SpendableOutputDescriptor::DelayedPaymentOutput(ref descriptor) }
1743-
if descriptor.outpoint.index as u32 == htlc_commitment_tx_output_idx => {
1742+
descriptor: SpendableOutputDescriptor::DelayedPaymentOutput(_) }
1743+
if event.transaction.as_ref().map(|tx| tx.input.iter()
1744+
.any(|inp| Some(inp.previous_output.txid) == confirmed_txid &&
1745+
inp.previous_output.vout == htlc_commitment_tx_output_idx))
1746+
.unwrap_or(false)
1747+
=> {
17441748
debug_assert!(holder_delayed_output_pending.is_none());
17451749
holder_delayed_output_pending = Some(event.confirmation_threshold());
17461750
},
@@ -1852,8 +1856,7 @@ impl<Signer: WriteableEcdsaChannelSigner> ChannelMonitor<Signer> {
18521856
/// confirmations on the claim transaction.
18531857
///
18541858
/// Note that for `ChannelMonitors` which track a channel which went on-chain with versions of
1855-
/// LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted
1856-
/// a revoked state.
1859+
/// LDK prior to 0.0.111, not all or excess balances may be included.
18571860
///
18581861
/// See [`Balance`] for additional details on the types of claimable balances which
18591862
/// may be returned here and their meanings.

0 commit comments

Comments
 (0)