@@ -184,25 +184,47 @@ pub enum PendingHTLCRouting {
184184 },
185185}
186186
187- /// Full details of an incoming HTLC, including routing info.
187+ /// Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it
188+ /// should go next.
188189#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
189190pub struct PendingHTLCInfo {
190191 /// Further routing details based on whether the HTLC is being forwarded or received.
191192 pub routing: PendingHTLCRouting,
192- /// Shared secret from the previous hop.
193- /// Used encrypt failure packets in the event that the HTLC needs to be failed backwards.
193+ /// The onion shared secret we build with the sender used to decrypt the onion.
194+ ///
195+ /// This is later used to encrypt failure packets in the event that the HTLC is failed.
194196 pub incoming_shared_secret: [u8; 32],
195197 /// Hash of the payment preimage, to lock the payment until the receiver releases the preimage.
196198 pub payment_hash: PaymentHash,
197- /// Amount offered by this HTLC.
198- pub incoming_amt_msat: Option<u64>, // Added in 0.0.113
199- /// Sender intended amount to forward or receive (actual amount received
200- /// may overshoot this in either case)
199+ /// Amount received in the incoming HTLC.
200+ ///
201+ /// This field was added in LDK 0.0.113 and will be `None` for objects written by prior
202+ /// versions.
203+ pub incoming_amt_msat: Option<u64>,
204+ /// The amount the sender indicated should be forwarded on to the next hop or amount the sender
205+ /// intended for us to receive for received payments.
206+ ///
207+ /// If the received amount is less than this for received payments, an intermediary hop has
208+ /// attempted to steal some of our funds and we should fail the HTLC (the sender should retry
209+ /// it along another path).
210+ ///
211+ /// Because nodes can take less than their required fees, and because senders may wish to
212+ /// improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for
213+ /// received payments. In such cases, recipients must handle this HTLC as if it had received
214+ /// [`Self::outgoing_amt_msat`].
201215 pub outgoing_amt_msat: u64,
202- /// Outgoing timelock expiration blockheight.
216+ /// The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated
217+ /// should have been set on the received HTLC for received payments).
203218 pub outgoing_cltv_value: u32,
204- /// The fee being skimmed off the top of this HTLC. If this is a forward, it'll be the fee we are
205- /// skimming. If we're receiving this HTLC, it's the fee that our counterparty skimmed.
219+ /// The fee taken for this HTLC in addition to the standard protocol HTLC fees.
220+ ///
221+ /// If this is a payment for forwarding, this is the fee we are taking before forwarding the
222+ /// HTLC.
223+ ///
224+ /// If this is a received payment, this is the fee that our counterparty took.
225+ ///
226+ /// This is used to allow LSPs to take fees as a part of payments, without the sender having to
227+ /// shoulder them.
206228 pub skimmed_fee_msat: Option<u64>,
207229}
208230
0 commit comments