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