@@ -418,6 +418,32 @@ fn one_blinded_hop() {
418
418
pass_along_path ( & nodes) ;
419
419
}
420
420
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 = BlindedMessagePath :: new_with_dummy_hops (
430
+ & [ ] ,
431
+ 5 ,
432
+ nodes[ 1 ] . node_id ,
433
+ context,
434
+ entropy,
435
+ & secp_ctx,
436
+ )
437
+ . unwrap ( ) ;
438
+ // Make sure that dummy hops are do added to the blinded path.
439
+ assert_eq ! ( blinded_path. blinded_hops( ) . len( ) , 6 ) ;
440
+ let destination = Destination :: BlindedPath ( blinded_path) ;
441
+ let instructions = MessageSendInstructions :: WithoutReplyPath { destination } ;
442
+ nodes[ 0 ] . messenger . send_onion_message ( test_msg, instructions) . unwrap ( ) ;
443
+ nodes[ 1 ] . custom_message_handler . expect_message ( TestCustomMessage :: Pong ) ;
444
+ pass_along_path ( & nodes) ;
445
+ }
446
+
421
447
#[ test]
422
448
fn two_unblinded_two_blinded ( ) {
423
449
let nodes = create_nodes ( 5 ) ;
@@ -611,8 +637,9 @@ fn test_blinded_path_padding_for_full_length_path() {
611
637
// Update the context to create a larger final receive TLVs, ensuring that
612
638
// the hop sizes vary before padding.
613
639
let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
614
- let blinded_path = BlindedMessagePath :: new (
640
+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
615
641
& intermediate_nodes,
642
+ 5 ,
616
643
nodes[ 3 ] . node_id ,
617
644
context,
618
645
& * nodes[ 3 ] . entropy_source ,
@@ -644,8 +671,9 @@ fn test_blinded_path_no_padding_for_compact_path() {
644
671
// Update the context to create a larger final receive TLVs, ensuring that
645
672
// the hop sizes vary before padding.
646
673
let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
647
- let blinded_path = BlindedMessagePath :: new (
674
+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
648
675
& intermediate_nodes,
676
+ 5 ,
649
677
nodes[ 3 ] . node_id ,
650
678
context,
651
679
& * nodes[ 3 ] . entropy_source ,
0 commit comments