Skip to content

Commit 703c1cf

Browse files
committed
Introduce custom data test for message::ReceiveTlvs
1 parent a58cc77 commit 703c1cf

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lightning/src/onion_message/functional_tests.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,24 @@ fn one_blinded_hop() {
416416
pass_along_path(&nodes);
417417
}
418418

419+
#[test]
420+
fn one_blinded_hop_with_custom_data() {
421+
let nodes = create_nodes(2);
422+
let test_msg = TestCustomMessage::Pong;
423+
424+
let secp_ctx = Secp256k1::new();
425+
let recipient_tlvs = ReceiveTlvs {
426+
context: Some(MessageContext::Custom(Vec::new())),
427+
custom_data: Some(vec![42; 42]),
428+
};
429+
let blinded_path = BlindedMessagePath::new(&[], nodes[1].node_id, recipient_tlvs, &*nodes[1].entropy_source, &secp_ctx).unwrap();
430+
let destination = Destination::BlindedPath(blinded_path);
431+
let instructions = MessageSendInstructions::WithoutReplyPath { destination };
432+
nodes[0].messenger.send_onion_message(test_msg, instructions).unwrap();
433+
nodes[1].custom_message_handler.expect_message_with_custom_data(TestCustomMessage::Pong, vec![42; 42]);
434+
pass_along_path(&nodes);
435+
}
436+
419437
#[test]
420438
fn two_unblinded_two_blinded() {
421439
let nodes = create_nodes(5);

0 commit comments

Comments
 (0)