Skip to content

Commit 14c0d88

Browse files
committed
f - s/intended_value/sender_intended_value and clarify doc comment
1 parent b9bbdab commit 14c0d88

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lightning/src/ln/channelmanager.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ struct ClaimableHTLC {
191191
cltv_expiry: u32,
192192
/// The amount (in msats) of this MPP part
193193
value: u64,
194-
/// The amount (in msats) that the sender intended to be sent (used for
195-
/// validating total MPP amount)
196-
intended_value: u64,
194+
/// The amount (in msats) that the sender intended to be sent in this MPP
195+
/// part (used for validating total MPP amount)
196+
sender_intended_value: u64,
197197
onion_payload: OnionPayload,
198198
timer_ticks: u8,
199199
/// The sum total of all MPP parts
@@ -3261,7 +3261,7 @@ where
32613261
// if possible so that we don't prematurely mark MPP payments complete
32623262
// if routing nodes overpay
32633263
value: incoming_amt_msat.unwrap_or(outgoing_amt_msat),
3264-
intended_value: outgoing_amt_msat,
3264+
sender_intended_value: outgoing_amt_msat,
32653265
timer_ticks: 0,
32663266
total_msat: if let Some(data) = &payment_data { data.total_msat } else { outgoing_amt_msat },
32673267
cltv_expiry,
@@ -3316,9 +3316,9 @@ where
33163316
continue
33173317
}
33183318
}
3319-
let mut total_value = claimable_htlc.intended_value;
3319+
let mut total_value = claimable_htlc.sender_intended_value;
33203320
for htlc in htlcs.iter() {
3321-
total_value += htlc.intended_value;
3321+
total_value += htlc.sender_intended_value;
33223322
match &htlc.onion_payload {
33233323
OnionPayload::Invoice { .. } => {
33243324
if htlc.total_msat != $payment_data.total_msat {
@@ -3333,7 +3333,7 @@ where
33333333
}
33343334
if total_value >= msgs::MAX_VALUE_MSAT {
33353335
fail_htlc!(claimable_htlc, payment_hash);
3336-
} else if total_value - claimable_htlc.intended_value >= $payment_data.total_msat {
3336+
} else if total_value - claimable_htlc.sender_intended_value >= $payment_data.total_msat {
33373337
log_trace!(self.logger, "Failing HTLC with payment_hash {} as payment is already claimable",
33383338
log_bytes!(payment_hash.0));
33393339
fail_htlc!(claimable_htlc, payment_hash);
@@ -6775,7 +6775,7 @@ impl Writeable for ClaimableHTLC {
67756775
(0, self.prev_hop, required),
67766776
(1, self.total_msat, required),
67776777
(2, self.value, required),
6778-
(3, self.intended_value, required),
6778+
(3, self.sender_intended_value, required),
67796779
(4, payment_data, option),
67806780
(6, self.cltv_expiry, required),
67816781
(8, keysend_preimage, option),
@@ -6788,7 +6788,7 @@ impl Readable for ClaimableHTLC {
67886788
fn read<R: Read>(reader: &mut R) -> Result<Self, DecodeError> {
67896789
let mut prev_hop = crate::util::ser::RequiredWrapper(None);
67906790
let mut value = 0;
6791-
let mut intended_value = None;
6791+
let mut sender_intended_value = None;
67926792
let mut payment_data: Option<msgs::FinalOnionHopData> = None;
67936793
let mut cltv_expiry = 0;
67946794
let mut total_msat = None;
@@ -6797,7 +6797,7 @@ impl Readable for ClaimableHTLC {
67976797
(0, prev_hop, required),
67986798
(1, total_msat, option),
67996799
(2, value, required),
6800-
(3, intended_value, option),
6800+
(3, sender_intended_value, option),
68016801
(4, payment_data, option),
68026802
(6, cltv_expiry, required),
68036803
(8, keysend_preimage, option)
@@ -6826,7 +6826,7 @@ impl Readable for ClaimableHTLC {
68266826
prev_hop: prev_hop.0.unwrap(),
68276827
timer_ticks: 0,
68286828
value,
6829-
intended_value: intended_value.unwrap_or(value),
6829+
sender_intended_value: sender_intended_value.unwrap_or(value),
68306830
total_msat: total_msat.unwrap(),
68316831
onion_payload,
68326832
cltv_expiry,

0 commit comments

Comments
 (0)