Add internal docs for ChannelMonitor::payment_preimages
authorMatt Corallo <git@bluematt.me>
Fri, 22 Apr 2022 17:58:19 +0000 (17:58 +0000)
committerMatt Corallo <git@bluematt.me>
Sat, 28 May 2022 00:02:49 +0000 (00:02 +0000)
lightning/src/chain/channelmonitor.rs
lightning/src/ln/channel.rs
lightning/src/ln/channelmanager.rs

index fd66e585208b6b580e6f981d633fa8c0d94c028e..f0ee1c85937bd904862caa5845d93809653bc316 100644 (file)
@@ -655,6 +655,10 @@ pub(crate) struct ChannelMonitorImpl<Signer: Sign> {
        // 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<PaymentHash, PaymentPreimage>,
 
        // Note that `MonitorEvent`s MUST NOT be generated during update processing, only generated
index 1d204d18a17ed620b24a228d66856175137ceb5a..cde1e8a13bd0d678ef0d54da0fcf4458f2b482ae 100644 (file)
@@ -1703,11 +1703,11 @@ impl<Signer: Sign> Channel<Signer> {
                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).
index 19d0b5773184e7f34303a02caaccb3e756c9774d..5a58958b413d7cc68c220a1b409a4f8dc2c6a51c 100644 (file)
@@ -414,7 +414,9 @@ pub(super) struct ChannelHolder<Signer: Sign> {
        /// 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<u64, Vec<HTLCForwardInfo>>,
-       /// 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!