Skip to content

Commit 12d668c

Browse files
committed
Correct OnchainEvent conf height for counterparty preimage claims
`OnchainEventEntry::confirmation_threshold`'s handling for `OnchainEvent::HTLCSpendConfirmation` delays resolution of the on-chain event until the CSV delay is met. However, this doesn't make much sense for HTLC claims where our counterparty claimed the HTLC with a preimage - the HTLC is resolved at 6 confirmations not when the counterparty can get their money. Thus, we should check for `$holder_tx` before setting the `on_to_local_output_csv` field when handling HTLC transactions, which we do here. This also updates the code to match the documentation, which on both `on_to_local_output_csv` and on the comment two lines above this diff indicate that we should only include a value for claims by us.
1 parent 74ead94 commit 12d668c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3014,7 +3014,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
30143014
// wait for the CSV delay before dropping the HTLC from
30153015
// claimable balance if the claim was an HTLC-Success
30163016
// transaction.
3017-
on_to_local_output_csv: if accepted_preimage_claim {
3017+
on_to_local_output_csv: if accepted_preimage_claim && $holder_tx {
30183018
Some(self.on_holder_tx_csv) } else { None },
30193019
},
30203020
});

0 commit comments

Comments
 (0)