Skip to content

Commit 5397dcf

Browse files
Add test for dummy hop insertion
Introduces a test to verify correct handling of dummy hops in constructed blinded paths. Ensures that the added dummy hops are properly included and do not interfere with the real path. Co-authored-by: valentinewallace <[email protected]>
1 parent 04c45ad commit 5397dcf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lightning/src/onion_message/functional_tests.rs

+17
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,23 @@ fn one_blinded_hop() {
418418
pass_along_path(&nodes);
419419
}
420420

421+
#[test]
422+
fn blinded_path_with_dummy() {
423+
let nodes = create_nodes(2);
424+
let test_msg = TestCustomMessage::Pong;
425+
426+
let secp_ctx = Secp256k1::new();
427+
let context = MessageContext::Custom(Vec::new());
428+
let entropy = &*nodes[1].entropy_source;
429+
let blinded_path =
430+
BlindedMessagePath::new_with_dummy_hops(&[], 5, nodes[1].node_id, context, entropy, &secp_ctx).unwrap();
431+
let destination = Destination::BlindedPath(blinded_path);
432+
let instructions = MessageSendInstructions::WithoutReplyPath { destination };
433+
nodes[0].messenger.send_onion_message(test_msg, instructions).unwrap();
434+
nodes[1].custom_message_handler.expect_message(TestCustomMessage::Pong);
435+
pass_along_path(&nodes);
436+
}
437+
421438
#[test]
422439
fn two_unblinded_two_blinded() {
423440
let nodes = create_nodes(5);

0 commit comments

Comments
 (0)