@@ -418,6 +418,32 @@ 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 = 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+
421447#[ test]
422448fn two_unblinded_two_blinded ( ) {
423449 let nodes = create_nodes ( 5 ) ;
@@ -611,8 +637,9 @@ fn test_blinded_path_padding_for_full_length_path() {
611637 // Update the context to create a larger final receive TLVs, ensuring that
612638 // the hop sizes vary before padding.
613639 let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
614- let blinded_path = BlindedMessagePath :: new (
640+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
615641 & intermediate_nodes,
642+ 5 ,
616643 nodes[ 3 ] . node_id ,
617644 context,
618645 & * nodes[ 3 ] . entropy_source ,
@@ -644,8 +671,9 @@ fn test_blinded_path_no_padding_for_compact_path() {
644671 // Update the context to create a larger final receive TLVs, ensuring that
645672 // the hop sizes vary before padding.
646673 let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
647- let blinded_path = BlindedMessagePath :: new (
674+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
648675 & intermediate_nodes,
676+ 5 ,
649677 nodes[ 3 ] . node_id ,
650678 context,
651679 & * nodes[ 3 ] . entropy_source ,
0 commit comments