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};
14831
+
use bitcoin::secp256k1::ecdh::SharedSecret;
14850
14832
use core::sync::atomic::Ordering;
14851
14833
use crate::events::{Event, HTLCDestination, ClosureReason};
14852
14834
use crate::ln::types::ChannelId;
14853
14835
use crate::types::payment::{PaymentPreimage, PaymentHash, PaymentSecret};
14854
14836
use crate::ln::channelmanager::{create_recv_pending_htlc_info, inbound_payment, ChannelConfigOverrides, HTLCForwardInfo, InterceptId, PaymentId, RecipientOnionFields};
14855
14837
use crate::ln::functional_test_utils::*;
14856
14838
use crate::ln::msgs::{self, BaseMessageHandler, ChannelMessageHandler, AcceptChannel, ErrorAction, MessageSendEvent};
14839
+
use crate::ln::onion_utils;
14857
14840
use crate::ln::outbound_payment::Retry;
14858
14841
use crate::prelude::*;
14859
14842
use crate::routing::router::{PaymentParameters, RouteParameters, find_route};
@@ -15944,17 +15927,20 @@ mod tests {
15944
15927
let node = create_network(1, &node_cfg, &node_chanmgr);
15945
15928
let sender_intended_amt_msat = 100;
15946
15929
let extra_fee_msat = 10;
15947
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload {
15948
-
sender_intended_htlc_amt_msat: 100,
15949
-
cltv_expiry_height: 42,
15950
-
payment_metadata: None,
15951
-
keysend_preimage: None,
15952
-
payment_data: Some(msgs::FinalOnionHopData {
15953
-
payment_secret: PaymentSecret([0; 32]),
15954
-
total_msat: sender_intended_amt_msat,
15955
-
}),
15956
-
custom_tlvs: Vec::new(),
15957
-
});
15930
+
let hop_data = onion_utils::Hop::Receive {
15931
+
hop_data: msgs::InboundOnionReceivePayload {
15932
+
sender_intended_htlc_amt_msat: 100,
15933
+
cltv_expiry_height: 42,
15934
+
payment_metadata: None,
15935
+
keysend_preimage: None,
15936
+
payment_data: Some(msgs::FinalOnionHopData {
15937
+
payment_secret: PaymentSecret([0; 32]),
15938
+
total_msat: sender_intended_amt_msat,
15939
+
}),
15940
+
custom_tlvs: Vec::new(),
15941
+
},
15942
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15943
+
};
15958
15944
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15959
15945
// intended amount, we fail the payment.
15960
15946
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
@@ -15967,17 +15953,20 @@ mod tests {
15967
15953
} else { panic!(); }
15968
15954
15969
15955
// If amt_received + extra_fee is equal to the sender intended amount, we're fine.
15970
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15971
-
sender_intended_htlc_amt_msat: 100,
15972
-
cltv_expiry_height: 42,
15973
-
payment_metadata: None,
15974
-
keysend_preimage: None,
15975
-
payment_data: Some(msgs::FinalOnionHopData {
15976
-
payment_secret: PaymentSecret([0; 32]),
15977
-
total_msat: sender_intended_amt_msat,
15978
-
}),
15979
-
custom_tlvs: Vec::new(),
15980
-
});
15956
+
let hop_data = onion_utils::Hop::Receive {
15957
+
hop_data: msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15958
+
sender_intended_htlc_amt_msat: 100,
15959
+
cltv_expiry_height: 42,
15960
+
payment_metadata: None,
15961
+
keysend_preimage: None,
15962
+
payment_data: Some(msgs::FinalOnionHopData {
15963
+
payment_secret: PaymentSecret([0; 32]),
15964
+
total_msat: sender_intended_amt_msat,
15965
+
}),
15966
+
custom_tlvs: Vec::new(),
15967
+
},
15968
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15969
+
};
15981
15970
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
0 commit comments