Skip to content

Commit 34b4820

Browse files
committed
Clarify OnchainEvent::Claim behavior
The previous documentation was slightly incorrect, a `Claim` can also be from the counterparty if they happened to claim the same exact set of outputs as a claiming transaction we generated.
1 parent b6a3663 commit 34b4820

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

lightning/src/chain/onchaintx.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,23 @@ impl OnchainEventEntry {
7272
}
7373
}
7474

75-
/// Upon discovering of some classes of onchain tx by ChannelMonitor, we may have to take actions on it
76-
/// once they mature to enough confirmations (ANTI_REORG_DELAY)
75+
/// Events for claims the [`OnchainTxHandler`] has generated. Once the events are considered safe
76+
/// from a chain reorg, the [`OnchainTxHandler`] will act accordingly.
7777
#[derive(PartialEq, Eq)]
7878
enum OnchainEvent {
79-
/// Outpoint under claim process by our own tx, once this one get enough confirmations, we remove it from
80-
/// bump-txn candidate buffer.
79+
/// A pending request has been claimed by a transaction spending the exact same set of outpoints
80+
/// as the request. This claim can either be ours or from the counterparty. Once the claiming
81+
/// transaction has met [`ANTI_REORG_DELAY`] confirmations, we consider it final and remove the
82+
/// pending request.
8183
Claim {
8284
package_id: PackageID,
8385
},
84-
/// Claim tx aggregate multiple claimable outpoints. One of the outpoint may be claimed by a counterparty party tx.
85-
/// In this case, we need to drop the outpoint and regenerate a new claim tx. By safety, we keep tracking
86-
/// the outpoint to be sure to resurect it back to the claim tx if reorgs happen.
86+
/// The counterparty has claimed an outpoint from one of our pending requests through a
87+
/// different transaction than ours. If our transaction was attempting to claim multiple
88+
/// outputs, we need to drop the outpoint claimed by the counterparty and regenerate a new claim
89+
/// transaction for ourselves. We keep tracking, separately, the outpoint claimed by the
90+
/// counterparty up to [`ANTI_REORG_DELAY`] confirmations to ensure we attempt to re-claim it
91+
/// if the counterparty's claim is reorged from the chain.
8792
ContentiousOutpoint {
8893
package: PackageTemplate,
8994
}

0 commit comments

Comments
 (0)