]> git.bitcoin.ninja Git - rust-lightning/commitdiff
Rename OutboundOnionPayload::Receive::amt_msat to be more descriptive.
authorValentine Wallace <vwallace@protonmail.com>
Thu, 14 Dec 2023 20:32:34 +0000 (15:32 -0500)
committerValentine Wallace <vwallace@protonmail.com>
Wed, 10 Jan 2024 15:56:24 +0000 (10:56 -0500)
lightning/src/ln/functional_tests.rs
lightning/src/ln/msgs.rs
lightning/src/ln/onion_utils.rs

index 2ad53faa8b2e129874cbec1391156ab58aabc6e5..07a635588e2ab7f0a48d73f4290dd472e5057771 100644 (file)
@@ -8216,8 +8216,10 @@ fn test_onion_value_mpp_set_calculation() {
                                RecipientOnionFields::secret_only(our_payment_secret), height + 1, &None).unwrap();
                        // Edit amt_to_forward to simulate the sender having set
                        // the final amount and the routing node taking less fee
-                       if let msgs::OutboundOnionPayload::Receive { ref mut amt_msat, .. } = onion_payloads[1] {
-                               *amt_msat = 99_000;
+                       if let msgs::OutboundOnionPayload::Receive {
+                               ref mut sender_intended_htlc_amt_msat, ..
+                       } = onion_payloads[1] {
+                               *sender_intended_htlc_amt_msat = 99_000;
                        } else { panic!() }
                        let new_onion_packet = onion_utils::construct_onion_packet(onion_payloads, onion_keys, [0; 32], &our_payment_hash).unwrap();
                        payment_event.msgs[0].onion_routing_packet = new_onion_packet;
index 39a2b2afa2c32e0ba78efb5875d840b6e28a82de..ff9d2c1958555b2c627462ee9860cdc50b295579 100644 (file)
@@ -1738,7 +1738,7 @@ mod fuzzy_internal_msgs {
                        payment_metadata: Option<Vec<u8>>,
                        keysend_preimage: Option<PaymentPreimage>,
                        custom_tlvs: Vec<(u64, Vec<u8>)>,
-                       amt_msat: u64,
+                       sender_intended_htlc_amt_msat: u64,
                        cltv_expiry_height: u32,
                },
                BlindedForward {
@@ -2289,8 +2289,8 @@ impl Writeable for OutboundOnionPayload {
                                });
                        },
                        Self::Receive {
-                               ref payment_data, ref payment_metadata, ref keysend_preimage, amt_msat, cltv_expiry_height,
-                               ref custom_tlvs,
+                               ref payment_data, ref payment_metadata, ref keysend_preimage, sender_intended_htlc_amt_msat,
+                               cltv_expiry_height, ref custom_tlvs,
                        } => {
                                // We need to update [`ln::outbound_payment::RecipientOnionFields::with_custom_tlvs`]
                                // to reject any reserved types in the experimental range if new ones are ever
@@ -2299,7 +2299,7 @@ impl Writeable for OutboundOnionPayload {
                                let mut custom_tlvs: Vec<&(u64, Vec<u8>)> = custom_tlvs.iter().chain(keysend_tlv.iter()).collect();
                                custom_tlvs.sort_unstable_by_key(|(typ, _)| *typ);
                                _encode_varint_length_prefixed_tlv!(w, {
-                                       (2, HighZeroBytesDroppedBigSize(*amt_msat), required),
+                                       (2, HighZeroBytesDroppedBigSize(*sender_intended_htlc_amt_msat), required),
                                        (4, HighZeroBytesDroppedBigSize(*cltv_expiry_height), required),
                                        (8, payment_data, option),
                                        (16, payment_metadata.as_ref().map(|m| WithoutLength(m)), option)
@@ -4018,7 +4018,7 @@ mod tests {
                        payment_data: None,
                        payment_metadata: None,
                        keysend_preimage: None,
-                       amt_msat: 0x0badf00d01020304,
+                       sender_intended_htlc_amt_msat: 0x0badf00d01020304,
                        cltv_expiry_height: 0xffffffff,
                        custom_tlvs: vec![],
                };
@@ -4046,7 +4046,7 @@ mod tests {
                        }),
                        payment_metadata: None,
                        keysend_preimage: None,
-                       amt_msat: 0x0badf00d01020304,
+                       sender_intended_htlc_amt_msat: 0x0badf00d01020304,
                        cltv_expiry_height: 0xffffffff,
                        custom_tlvs: vec![],
                };
@@ -4086,7 +4086,7 @@ mod tests {
                        payment_metadata: None,
                        keysend_preimage: None,
                        custom_tlvs: bad_type_range_tlvs,
-                       amt_msat: 0x0badf00d01020304,
+                       sender_intended_htlc_amt_msat: 0x0badf00d01020304,
                        cltv_expiry_height: 0xffffffff,
                };
                let encoded_value = msg.encode();
@@ -4118,7 +4118,7 @@ mod tests {
                        payment_metadata: None,
                        keysend_preimage: None,
                        custom_tlvs: expected_custom_tlvs.clone(),
-                       amt_msat: 0x0badf00d01020304,
+                       sender_intended_htlc_amt_msat: 0x0badf00d01020304,
                        cltv_expiry_height: 0xffffffff,
                };
                let encoded_value = msg.encode();
@@ -4131,12 +4131,12 @@ mod tests {
                        payment_metadata: None,
                        keysend_preimage: None,
                        custom_tlvs,
-                       sender_intended_htlc_amt_msat: amt_msat,
+                       sender_intended_htlc_amt_msat,
                        cltv_expiry_height: outgoing_cltv_value,
                        ..
                } = inbound_msg {
                        assert_eq!(custom_tlvs, expected_custom_tlvs);
-                       assert_eq!(amt_msat, 0x0badf00d01020304);
+                       assert_eq!(sender_intended_htlc_amt_msat, 0x0badf00d01020304);
                        assert_eq!(outgoing_cltv_value, 0xffffffff);
                } else { panic!(); }
        }
index a83f9dc5a64cd90e297c2d8de03f79405e7bcca0..f3112c207e621e4e1203d3771fdba94dc8826591 100644 (file)
@@ -214,7 +214,7 @@ pub(super) fn build_onion_payloads(path: &Path, total_msat: u64, mut recipient_o
                                        payment_metadata: recipient_onion.payment_metadata.take(),
                                        keysend_preimage: *keysend_preimage,
                                        custom_tlvs: recipient_onion.custom_tlvs.clone(),
-                                       amt_msat: value_msat,
+                                       sender_intended_htlc_amt_msat: value_msat,
                                        cltv_expiry_height: cltv,
                                });
                        }