Skip to content

Commit e55c7e2

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 f9b80be commit e55c7e2

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
@@ -2961,7 +2961,7 @@ impl<Signer: Sign> ChannelMonitorImpl<Signer> {
29612961
// wait for the CSV delay before dropping the HTLC from
29622962
// claimable balance if the claim was an HTLC-Success
29632963
// transaction.
2964-
on_to_local_output_csv: if accepted_preimage_claim {
2964+
on_to_local_output_csv: if accepted_preimage_claim && $holder_tx {
29652965
Some(self.on_holder_tx_csv) } else { None },
29662966
},
29672967
});

0 commit comments

Comments
 (0)