@@ -443,6 +443,34 @@ fn one_blinded_hop() {
443443 pass_along_path ( & nodes) ;
444444}
445445
446+ #[ test]
447+ fn blinded_path_with_dummy ( ) {
448+ let nodes = create_nodes ( 2 ) ;
449+ let test_msg = TestCustomMessage :: Pong ;
450+
451+ let secp_ctx = Secp256k1 :: new ( ) ;
452+ let context = MessageContext :: Custom ( Vec :: new ( ) ) ;
453+ let entropy = & * nodes[ 1 ] . entropy_source ;
454+ let receive_key = nodes[ 1 ] . messenger . node_signer . get_receive_auth_key ( ) ;
455+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
456+ & [ ] ,
457+ nodes[ 1 ] . node_id ,
458+ 5 ,
459+ receive_key,
460+ context,
461+ entropy,
462+ & secp_ctx,
463+ )
464+ . unwrap ( ) ;
465+ // Ensure that dummy hops are added to the blinded path.
466+ assert_eq ! ( blinded_path. blinded_hops( ) . len( ) , 6 ) ;
467+ let destination = Destination :: BlindedPath ( blinded_path) ;
468+ let instructions = MessageSendInstructions :: WithoutReplyPath { destination } ;
469+ nodes[ 0 ] . messenger . send_onion_message ( test_msg, instructions) . unwrap ( ) ;
470+ nodes[ 1 ] . custom_message_handler . expect_message ( TestCustomMessage :: Pong ) ;
471+ pass_along_path ( & nodes) ;
472+ }
473+
446474#[ test]
447475fn two_unblinded_two_blinded ( ) {
448476 let nodes = create_nodes ( 5 ) ;
@@ -658,9 +686,10 @@ fn test_blinded_path_padding_for_full_length_path() {
658686 let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
659687 let entropy = & * nodes[ 3 ] . entropy_source ;
660688 let receive_key = nodes[ 3 ] . messenger . node_signer . get_receive_auth_key ( ) ;
661- let blinded_path = BlindedMessagePath :: new (
689+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
662690 & intermediate_nodes,
663691 nodes[ 3 ] . node_id ,
692+ 5 ,
664693 receive_key,
665694 context,
666695 entropy,
@@ -694,9 +723,10 @@ fn test_blinded_path_no_padding_for_compact_path() {
694723 let context = MessageContext :: Custom ( vec ! [ 0u8 ; 42 ] ) ;
695724 let entropy = & * nodes[ 3 ] . entropy_source ;
696725 let receive_key = nodes[ 3 ] . messenger . node_signer . get_receive_auth_key ( ) ;
697- let blinded_path = BlindedMessagePath :: new (
726+ let blinded_path = BlindedMessagePath :: new_with_dummy_hops (
698727 & intermediate_nodes,
699728 nodes[ 3 ] . node_id ,
729+ 5 ,
700730 receive_key,
701731 context,
702732 entropy,
0 commit comments