You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For pending HTLC info processing, we will later need to access both the
outer and the Trampoline payloads. Thanks to the refactor eliminating
invalid Hop states, this is now possible by accessing the Hop struct,
which will carry both outer and Trampoline payload data when applicable.
use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
14835
14816
use core::sync::atomic::Ordering;
14817
+
use bitcoin::secp256k1::ecdh::SharedSecret;
14836
14818
use crate::events::{Event, HTLCDestination, MessageSendEvent, MessageSendEventsProvider, ClosureReason};
14837
14819
use crate::ln::types::ChannelId;
14838
14820
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
14839
14821
use crate::ln::channelmanager::{create_recv_pending_htlc_info, inbound_payment, ChannelConfigOverrides, HTLCForwardInfo, InterceptId, PaymentId, RecipientOnionFields};
14840
14822
use crate::ln::functional_test_utils::*;
14841
14823
use crate::ln::msgs::{self, AcceptChannel, ErrorAction};
14842
14824
use crate::ln::msgs::ChannelMessageHandler;
14825
+
use crate::ln::onion_utils;
14843
14826
use crate::ln::outbound_payment::Retry;
14844
14827
use crate::prelude::*;
14845
14828
use crate::routing::router::{PaymentParameters, RouteParameters, find_route};
@@ -15930,17 +15913,20 @@ mod tests {
15930
15913
let node = create_network(1, &node_cfg, &node_chanmgr);
15931
15914
let sender_intended_amt_msat = 100;
15932
15915
let extra_fee_msat = 10;
15933
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload {
15934
-
sender_intended_htlc_amt_msat: 100,
15935
-
cltv_expiry_height: 42,
15936
-
payment_metadata: None,
15937
-
keysend_preimage: None,
15938
-
payment_data: Some(msgs::FinalOnionHopData {
15939
-
payment_secret: PaymentSecret([0; 32]),
15940
-
total_msat: sender_intended_amt_msat,
15941
-
}),
15942
-
custom_tlvs: Vec::new(),
15943
-
});
15916
+
let hop_data = onion_utils::Hop::Receive {
15917
+
hop_data: msgs::InboundOnionReceivePayload {
15918
+
sender_intended_htlc_amt_msat: 100,
15919
+
cltv_expiry_height: 42,
15920
+
payment_metadata: None,
15921
+
keysend_preimage: None,
15922
+
payment_data: Some(msgs::FinalOnionHopData {
15923
+
payment_secret: PaymentSecret([0; 32]),
15924
+
total_msat: sender_intended_amt_msat,
15925
+
}),
15926
+
custom_tlvs: Vec::new(),
15927
+
},
15928
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15929
+
};
15944
15930
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15945
15931
// intended amount, we fail the payment.
15946
15932
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
@@ -15953,17 +15939,20 @@ mod tests {
15953
15939
} else { panic!(); }
15954
15940
15955
15941
// If amt_received + extra_fee is equal to the sender intended amount, we're fine.
15956
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15957
-
sender_intended_htlc_amt_msat: 100,
15958
-
cltv_expiry_height: 42,
15959
-
payment_metadata: None,
15960
-
keysend_preimage: None,
15961
-
payment_data: Some(msgs::FinalOnionHopData {
15962
-
payment_secret: PaymentSecret([0; 32]),
15963
-
total_msat: sender_intended_amt_msat,
15964
-
}),
15965
-
custom_tlvs: Vec::new(),
15966
-
});
15942
+
let hop_data = onion_utils::Hop::Receive {
15943
+
hop_data: msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15944
+
sender_intended_htlc_amt_msat: 100,
15945
+
cltv_expiry_height: 42,
15946
+
payment_metadata: None,
15947
+
keysend_preimage: None,
15948
+
payment_data: Some(msgs::FinalOnionHopData {
15949
+
payment_secret: PaymentSecret([0; 32]),
15950
+
total_msat: sender_intended_amt_msat,
15951
+
}),
15952
+
custom_tlvs: Vec::new(),
15953
+
},
15954
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15955
+
};
15967
15956
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
0 commit comments