Skip to content

Commit 3287c79

Browse files
committed
f doc preimages better
1 parent ed62212 commit 3287c79

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lightning/src/chain/channelmonitor.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,7 +923,15 @@ pub(crate) struct ChannelMonitorImpl<Signer: EcdsaChannelSigner> {
923923
/// The set of payment hashes from inbound payments for which we know the preimage. Payment
924924
/// preimages that are not included in any unrevoked local commitment transaction or unrevoked
925925
/// remote commitment transactions are automatically removed when commitment transactions are
926-
/// revoked.
926+
/// revoked. Note that this happens one revocation after it theoretically could, leaving
927+
/// preimages present here for the previous state even when the channel is "at rest". This is a
928+
/// good safety buffer, but also is important as it ensures we retain payment preimages for the
929+
/// previous local commitment transaction, which may have been broadcast already when we see
930+
/// the revocation (in setups with redundant monitors).
931+
///
932+
/// We also store [`PaymentClaimDetails`] here, tracking the payment information(s) for this
933+
/// preimage for inbound payments. This allows us to rebuild the inbound payment information on
934+
/// startup even if we lost our `ChannelManager`.
927935
payment_preimages: HashMap<PaymentHash, (PaymentPreimage, Vec<PaymentClaimDetails>)>,
928936

929937
// Note that `MonitorEvent`s MUST NOT be generated during update processing, only generated

0 commit comments

Comments
 (0)