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