Skip to content

Commit dd6ecb1

Browse files
committed
Introduce custom data test for message::ReceiveTlvs
1 parent 37e373f commit dd6ecb1

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

lightning/src/ln/async_payments_tests.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ fn static_invoice_unknown_required_features() {
286286
context: Some(MessageContext::Offers(OffersContext::InvoiceRequest {
287287
nonce: Nonce([42; 16]),
288288
})),
289+
custom_data: None,
289290
};
290291

291292
let blinded_paths_to_always_online_node = nodes[1]
@@ -371,6 +372,7 @@ fn ignore_unexpected_static_invoice() {
371372
context: Some(MessageContext::Offers(OffersContext::InvoiceRequest {
372373
nonce: Nonce([42; 16]),
373374
})),
375+
custom_data: None,
374376
};
375377

376378
// Initiate payment to the sender's intended offer.
@@ -515,6 +517,7 @@ fn pays_static_invoice() {
515517
context: Some(MessageContext::Offers(OffersContext::InvoiceRequest {
516518
nonce: Nonce([42; 16]),
517519
})),
520+
custom_data: None,
518521
};
519522

520523
let blinded_paths_to_always_online_node = nodes[1]

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)