@@ -208,25 +208,47 @@ impl PendingHTLCRouting {
208
208
}
209
209
}
210
210
211
- /// Full details of an incoming HTLC, including routing info.
211
+ /// Information about an incoming HTLC, including the [`PendingHTLCRouting`] describing where it
212
+ /// should go next.
212
213
#[derive(Clone)] // See Channel::revoke_and_ack for why, tl;dr: Rust bug
213
214
pub struct PendingHTLCInfo {
214
215
/// Further routing details based on whether the HTLC is being forwarded or received.
215
216
pub routing: PendingHTLCRouting,
216
- /// Shared secret from the previous hop.
217
- /// Used encrypt failure packets in the event that the HTLC needs to be failed backwards.
217
+ /// The onion shared secret we build with the sender used to decrypt the onion.
218
+ ///
219
+ /// This is later used to encrypt failure packets in the event that the HTLC is failed.
218
220
pub incoming_shared_secret: [u8; 32],
219
221
/// Hash of the payment preimage, to lock the payment until the receiver releases the preimage.
220
222
pub payment_hash: PaymentHash,
221
- /// Amount offered by this HTLC.
222
- pub incoming_amt_msat: Option<u64>, // Added in 0.0.113
223
- /// Sender intended amount to forward or receive (actual amount received
224
- /// may overshoot this in either case)
223
+ /// Amount received in the incoming HTLC.
224
+ ///
225
+ /// This field was added in LDK 0.0.113 and will be `None` for objects written by prior
226
+ /// versions.
227
+ pub incoming_amt_msat: Option<u64>,
228
+ /// The amount the sender indicated should be forwarded on to the next hop or amount the sender
229
+ /// intended for us to receive for received payments.
230
+ ///
231
+ /// If the received amount is less than this for received payments, an intermediary hop has
232
+ /// attempted to steal some of our funds and we should fail the HTLC (the sender should retry
233
+ /// it along another path).
234
+ ///
235
+ /// Because nodes can take less than their required fees, and because senders may wish to
236
+ /// improve their own privacy, this amount may be less than [`Self::incoming_amt_msat`] for
237
+ /// received payments. In such cases, recipients must handle this HTLC as if it had received
238
+ /// [`Self::outgoing_amt_msat`].
225
239
pub outgoing_amt_msat: u64,
226
- /// Outgoing timelock expiration blockheight.
240
+ /// The CLTV the sender has indicated we should set on the forwarded HTLC (or has indicated
241
+ /// should have been set on the received HTLC for received payments).
227
242
pub outgoing_cltv_value: u32,
228
- /// The fee being skimmed off the top of this HTLC. If this is a forward, it'll be the fee we are
229
- /// skimming. If we're receiving this HTLC, it's the fee that our counterparty skimmed.
243
+ /// The fee taken for this HTLC in addition to the standard protocol HTLC fees.
244
+ ///
245
+ /// If this is a payment for forwarding, this is the fee we are taking before forwarding the
246
+ /// HTLC.
247
+ ///
248
+ /// If this is a received payment, this is the fee that our counterparty took.
249
+ ///
250
+ /// This is used to allow LSPs to take fees as a part of payments, without the sender having to
251
+ /// shoulder them.
230
252
pub skimmed_fee_msat: Option<u64>,
231
253
}
232
254
0 commit comments