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};
14816
+
use bitcoin::secp256k1::ecdh::SharedSecret;
14835
14817
use core::sync::atomic::Ordering;
14836
14818
use crate::events::{Event, HTLCDestination, 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, BaseMessageHandler, ChannelMessageHandler, AcceptChannel, ErrorAction, MessageSendEvent};
14824
+
use crate::ln::onion_utils;
14842
14825
use crate::ln::outbound_payment::Retry;
14843
14826
use crate::prelude::*;
14844
14827
use crate::routing::router::{PaymentParameters, RouteParameters, find_route};
@@ -15929,17 +15912,20 @@ mod tests {
15929
15912
let node = create_network(1, &node_cfg, &node_chanmgr);
15930
15913
let sender_intended_amt_msat = 100;
15931
15914
let extra_fee_msat = 10;
15932
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload {
15933
-
sender_intended_htlc_amt_msat: 100,
15934
-
cltv_expiry_height: 42,
15935
-
payment_metadata: None,
15936
-
keysend_preimage: None,
15937
-
payment_data: Some(msgs::FinalOnionHopData {
15938
-
payment_secret: PaymentSecret([0; 32]),
15939
-
total_msat: sender_intended_amt_msat,
15940
-
}),
15941
-
custom_tlvs: Vec::new(),
15942
-
});
15915
+
let hop_data = onion_utils::Hop::Receive {
15916
+
hop_data: msgs::InboundOnionReceivePayload {
15917
+
sender_intended_htlc_amt_msat: 100,
15918
+
cltv_expiry_height: 42,
15919
+
payment_metadata: None,
15920
+
keysend_preimage: None,
15921
+
payment_data: Some(msgs::FinalOnionHopData {
15922
+
payment_secret: PaymentSecret([0; 32]),
15923
+
total_msat: sender_intended_amt_msat,
15924
+
}),
15925
+
custom_tlvs: Vec::new(),
15926
+
},
15927
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15928
+
};
15943
15929
// Check that if the amount we received + the penultimate hop extra fee is less than the sender
15944
15930
// intended amount, we fail the payment.
15945
15931
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
@@ -15952,17 +15938,20 @@ mod tests {
15952
15938
} else { panic!(); }
15953
15939
15954
15940
// If amt_received + extra_fee is equal to the sender intended amount, we're fine.
15955
-
let hop_data = msgs::InboundOnionPayload::Receive(msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15956
-
sender_intended_htlc_amt_msat: 100,
15957
-
cltv_expiry_height: 42,
15958
-
payment_metadata: None,
15959
-
keysend_preimage: None,
15960
-
payment_data: Some(msgs::FinalOnionHopData {
15961
-
payment_secret: PaymentSecret([0; 32]),
15962
-
total_msat: sender_intended_amt_msat,
15963
-
}),
15964
-
custom_tlvs: Vec::new(),
15965
-
});
15941
+
let hop_data = onion_utils::Hop::Receive {
15942
+
hop_data: msgs::InboundOnionReceivePayload { // This is the same payload as above, InboundOnionPayload doesn't implement Clone
15943
+
sender_intended_htlc_amt_msat: 100,
15944
+
cltv_expiry_height: 42,
15945
+
payment_metadata: None,
15946
+
keysend_preimage: None,
15947
+
payment_data: Some(msgs::FinalOnionHopData {
15948
+
payment_secret: PaymentSecret([0; 32]),
15949
+
total_msat: sender_intended_amt_msat,
15950
+
}),
15951
+
custom_tlvs: Vec::new(),
15952
+
},
15953
+
shared_secret: SharedSecret::from_bytes([0; 32]),
15954
+
};
15966
15955
let current_height: u32 = node[0].node.best_block.read().unwrap().height;
0 commit comments