From b8fa547c6693e98a842441157fe64a575f5b7d97 Mon Sep 17 00:00:00 2001 From: Valentine Wallace Date: Tue, 12 Dec 2023 17:45:46 -0500 Subject: [PATCH] Rename InboundOnionPayload::Receive::outgoing_cltv_value .. since there is no outgoing cltv for received HTLCs. --- lightning/src/ln/channelmanager.rs | 6 +++--- lightning/src/ln/msgs.rs | 14 +++++++------- lightning/src/ln/onion_payment.rs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 8ba0b52e8..5fe0ad3d6 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -12128,7 +12128,7 @@ mod tests { let extra_fee_msat = 10; let hop_data = msgs::InboundOnionPayload::Receive { amt_msat: 100, - outgoing_cltv_value: 42, + cltv_expiry_height: 42, payment_metadata: None, keysend_preimage: None, payment_data: Some(msgs::FinalOnionHopData { @@ -12150,7 +12150,7 @@ mod tests { // If amt_received + extra_fee is equal to the sender intended amount, we're fine. let hop_data = msgs::InboundOnionPayload::Receive { // This is the same payload as above, InboundOnionPayload doesn't implement Clone amt_msat: 100, - outgoing_cltv_value: 42, + cltv_expiry_height: 42, payment_metadata: None, keysend_preimage: None, payment_data: Some(msgs::FinalOnionHopData { @@ -12174,7 +12174,7 @@ mod tests { let current_height: u32 = node[0].node.best_block.read().unwrap().height(); let result = create_recv_pending_htlc_info(msgs::InboundOnionPayload::Receive { amt_msat: 100, - outgoing_cltv_value: 22, + cltv_expiry_height: 22, payment_metadata: None, keysend_preimage: None, payment_data: Some(msgs::FinalOnionHopData { diff --git a/lightning/src/ln/msgs.rs b/lightning/src/ln/msgs.rs index 2e56e2fc2..574f1b7cf 100644 --- a/lightning/src/ln/msgs.rs +++ b/lightning/src/ln/msgs.rs @@ -1707,7 +1707,7 @@ mod fuzzy_internal_msgs { keysend_preimage: Option, custom_tlvs: Vec<(u64, Vec)>, amt_msat: u64, - outgoing_cltv_value: u32, + cltv_expiry_height: u32, }, BlindedForward { short_channel_id: u64, @@ -2433,7 +2433,7 @@ impl ReadableArgs<(Option, &NS)> for InboundOnionPayload w payment_metadata: payment_metadata.map(|w| w.0), keysend_preimage, amt_msat: amt.ok_or(DecodeError::InvalidValue)?, - outgoing_cltv_value: cltv_value.ok_or(DecodeError::InvalidValue)?, + cltv_expiry_height: cltv_value.ok_or(DecodeError::InvalidValue)?, custom_tlvs, }) } @@ -4030,10 +4030,10 @@ mod tests { let node_signer = test_utils::TestKeysInterface::new(&[42; 32], Network::Testnet); let inbound_msg = ReadableArgs::read(&mut Cursor::new(&target_value[..]), (None, &&node_signer)).unwrap(); if let msgs::InboundOnionPayload::Receive { - payment_data: None, amt_msat, outgoing_cltv_value, .. + payment_data: None, amt_msat, cltv_expiry_height, .. } = inbound_msg { assert_eq!(amt_msat, 0x0badf00d01020304); - assert_eq!(outgoing_cltv_value, 0xffffffff); + assert_eq!(cltv_expiry_height, 0xffffffff); } else { panic!(); } } @@ -4062,14 +4062,14 @@ mod tests { payment_secret, total_msat: 0x1badca1f }), - amt_msat, outgoing_cltv_value, + amt_msat, cltv_expiry_height, payment_metadata: None, keysend_preimage: None, custom_tlvs, } = inbound_msg { assert_eq!(payment_secret, expected_payment_secret); assert_eq!(amt_msat, 0x0badf00d01020304); - assert_eq!(outgoing_cltv_value, 0xffffffff); + assert_eq!(cltv_expiry_height, 0xffffffff); assert_eq!(custom_tlvs, vec![]); } else { panic!(); } } @@ -4133,7 +4133,7 @@ mod tests { keysend_preimage: None, custom_tlvs, amt_msat, - outgoing_cltv_value, + cltv_expiry_height: outgoing_cltv_value, .. } = inbound_msg { assert_eq!(custom_tlvs, expected_custom_tlvs); diff --git a/lightning/src/ln/onion_payment.rs b/lightning/src/ln/onion_payment.rs index b04b78f65..ae602fb11 100644 --- a/lightning/src/ln/onion_payment.rs +++ b/lightning/src/ln/onion_payment.rs @@ -126,9 +126,9 @@ pub(super) fn create_recv_pending_htlc_info( payment_metadata, requires_blinded_error ) = match hop_data { msgs::InboundOnionPayload::Receive { - payment_data, keysend_preimage, custom_tlvs, amt_msat, outgoing_cltv_value, payment_metadata, .. + payment_data, keysend_preimage, custom_tlvs, amt_msat, cltv_expiry_height, payment_metadata, .. } => - (payment_data, keysend_preimage, custom_tlvs, amt_msat, outgoing_cltv_value, payment_metadata, + (payment_data, keysend_preimage, custom_tlvs, amt_msat, cltv_expiry_height, payment_metadata, false), msgs::InboundOnionPayload::BlindedReceive { amt_msat, total_msat, outgoing_cltv_value, payment_secret, intro_node_blinding_point, -- 2.39.5