Introduce Blinded Payment Dummy Path test
What changed, and why it matters
This commit adds a new automated test for a feature called 'dummy hops' in blinded payment paths. It only touches test code and does not change any production logic. There is no security issue here.
No action required. This is a benign test-only addition.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit introduces one_hop_blinded_path_with_dummy_hops, a unit test in lightning/src/ln/blinded_payment_tests.rs. It exercises the existing BlindedPaymentPath::new_with_dummy_hops API and the PassAlongPathArgs::with_dummy_tlvs helper to verify that a payment can be sent and claimed through a one-hop blinded path padded with dummy TLVs. No library or runtime code is modified.
Changed components
lightning/src/ln/blinded_payment_tests.rsInspect captured patch +68 / −2
diff --git a/lightning/src/ln/blinded_payment_tests.rs b/lightning/src/ln/blinded_payment_tests.rs
index a902cfe..3f7f36f 100644
--- a/lightning/src/ln/blinded_payment_tests.rs
+++ b/lightning/src/ln/blinded_payment_tests.rs
@@ -8,8 +8,8 @@
// licenses.
use crate::blinded_path::payment::{
- BlindedPaymentPath, Bolt12RefundContext, ForwardTlvs, PaymentConstraints, PaymentContext,
- PaymentForwardNode, PaymentRelay, ReceiveTlvs, PAYMENT_PADDING_ROUND_OFF,
+ BlindedPaymentPath, Bolt12RefundContext, DummyTlvs, ForwardTlvs, PaymentConstraints,
+ PaymentContext, PaymentForwardNode, PaymentRelay, ReceiveTlvs, PAYMENT_PADDING_ROUND_OFF,
};
use crate::blinded_path::utils::is_padded;
use crate::blinded_path::{self, BlindedHop};
@@ -196,6 +196,72 @@ fn do_one_hop_blinded_path(success: bool) {
}
}
+#[test]
+fn one_hop_blinded_path_with_dummy_hops() {
+ let chanmon_cfgs = create_chanmon_cfgs(2);
+ let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
+ let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]);
+ let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
+ let chan_upd =
+ create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0).0.contents;
+
+ let amt_msat = 5000;
+ let (payment_preimage, payment_hash, payment_secret) =
+ get_payment_preimage_hash(&nodes[1], Some(amt_msat), None);
+ let payee_tlvs = ReceiveTlvs {
+ payment_secret,
+ payment_constraints: PaymentConstraints {
+ max_cltv_expiry: u32::max_value(),
+ htlc_minimum_msat: chan_upd.htlc_minimum_msat,
+ },
+ payment_context: PaymentContext::Bolt12Refund(Bolt12RefundContext {}),
+ };
+ let receive_auth_key = chanmon_cfgs[1].keys_manager.get_receive_auth_key();
+ let dummy_tlvs = [DummyTlvs::default(); 2];
+
+ let mut secp_ctx = Secp256k1::new();
+ let blinded_path = BlindedPaymentPath::new_with_dummy_hops(
+ &[],
+ nodes[1].node.get_our_node_id(),
+ &dummy_tlvs,
+ receive_auth_key,
+ payee_tlvs,
+ u64::MAX,
+ TEST_FINAL_CLTV as u16,
+ &chanmon_cfgs[1].keys_manager,
+ &secp_ctx,
+ )
+ .unwrap();
+
+ let route_params = RouteParameters::from_payment_params_and_value(
+ PaymentParameters::blinded(vec![blinded_path]),
+ amt_msat,
+ );
+ nodes[0]
+ .node
+ .send_payment(
+ payment_hash,
+ RecipientOnionFields::spontaneous_empty(),
+ PaymentId(payment_hash.0),
+ route_params,
+ Retry::Attempts(0),
+ )
+ .unwrap();
+ check_added_monitors(&nodes[0], 1);
+
+ let mut events = nodes[0].node.get_and_clear_pending_msg_events();
+ assert_eq!(events.len(), 1);
+ let ev = remove_first_msg_event_to_node(&nodes[1].node.get_our_node_id(), &mut events);
+
+ let path = &[&nodes[1]];
+ let args = PassAlongPathArgs::new(&nodes[0], path, amt_msat, payment_hash, ev)
+ .with_dummy_tlvs(&dummy_tlvs)
+ .with_payment_secret(payment_secret);
+
+ do_pass_along_path(args);
+ claim_payment(&nodes[0], &[&nodes[1]], payment_preimage);
+}
+
#[test]
#[rustfmt::skip]
fn mpp_to_one_hop_blinded_path() {
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.