From 8a5670245a111b31b816c99c5b9a64c0df253e76 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 22 Apr 2022 17:58:19 +0000 Subject: [PATCH] Add internal docs for ChannelMonitor::payment_preimages --- lightning/src/chain/channelmonitor.rs | 4 ++++ lightning/src/ln/channel.rs | 6 +++--- lightning/src/ln/channelmanager.rs | 4 +++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lightning/src/chain/channelmonitor.rs b/lightning/src/chain/channelmonitor.rs index fd66e585..f0ee1c85 100644 --- a/lightning/src/chain/channelmonitor.rs +++ b/lightning/src/chain/channelmonitor.rs @@ -655,6 +655,10 @@ pub(crate) struct ChannelMonitorImpl { // deserialization current_holder_commitment_number: u64, + /// The set of payment hashes from inbound payments for which we know the preimage. Payment + /// preimages that are not included in any unrevoked local commitment transaction or unrevoked + /// remote commitment transactions are automatically removed when commitment transactions are + /// revoked. payment_preimages: HashMap, // Note that `MonitorEvent`s MUST NOT be generated during update processing, only generated diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index 1d204d18..cde1e8a1 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -1703,11 +1703,11 @@ impl Channel { make_funding_redeemscript(&self.get_holder_pubkeys().funding_pubkey, self.counterparty_funding_pubkey()) } - /// Claims an HTLC while we're disconnected from a peer, dropping the ChannelMonitorUpdate + /// Claims an HTLC while we're disconnected from a peer, dropping the [`ChannelMonitorUpdate`] /// entirely. /// - /// The ChannelMonitor for this channel MUST be updated out-of-band with the preimage provided - /// (i.e. without calling [`crate::chain::Watch::update_channel`]). + /// The [`ChannelMonitor`] for this channel MUST be updated out-of-band with the preimage + /// provided (i.e. without calling [`crate::chain::Watch::update_channel`]). /// /// The HTLC claim will end up in the holding cell (because the caller must ensure the peer is /// disconnected). diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 19d0b577..5a58958b 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -414,7 +414,9 @@ pub(super) struct ChannelHolder { /// guarantees are made about the existence of a channel with the short id here, nor the short /// ids in the PendingHTLCInfo! pub(super) forward_htlcs: HashMap>, - /// Map from payment hash to any HTLCs which are to us and can be failed/claimed by the user. + /// Map from payment hash to the payment data and any HTLCs which are to us and can be + /// failed/claimed by the user. + /// /// Note that while this is held in the same mutex as the channels themselves, no consistency /// guarantees are made about the channels given here actually existing anymore by the time you /// go to read them! -- 2.30.2