@@ -411,15 +411,15 @@ fn test_onion_failure() {
411411 // and tamper returning error message
412412 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
413413 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
414- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , NODE |2 , & [ 0 ; 0 ] ) ;
414+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , NODE |2 , & [ 0 ; 0 ] ) ;
415415 } , ||{ } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 0 ] . pubkey , is_permanent : false } ) , Some ( route. paths [ 0 ] . hops [ 0 ] . short_channel_id ) , Some ( next_hop_failure. clone ( ) ) ) ;
416416
417417 // final node failure
418418 run_onion_failure_test_with_fail_intercept ( "temporary_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
419419 // and tamper returning error message
420420 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
421421 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
422- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , NODE |2 , & [ 0 ; 0 ] ) ;
422+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , NODE |2 , & [ 0 ; 0 ] ) ;
423423 } , ||{
424424 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
425425 } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 1 ] . pubkey , is_permanent : false } ) , Some ( route. paths [ 0 ] . hops [ 1 ] . short_channel_id ) , None ) ;
@@ -431,14 +431,14 @@ fn test_onion_failure() {
431431 } , |msg| {
432432 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
433433 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
434- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
434+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
435435 } , ||{ } , true , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 0 ] . pubkey , is_permanent : true } ) , Some ( route. paths [ 0 ] . hops [ 0 ] . short_channel_id ) , Some ( next_hop_failure. clone ( ) ) ) ;
436436
437437 // final node failure
438438 run_onion_failure_test_with_fail_intercept ( "permanent_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
439439 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
440440 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
441- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
441+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
442442 } , ||{
443443 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
444444 } , false , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 1 ] . pubkey , is_permanent : true } ) , Some ( route. paths [ 0 ] . hops [ 1 ] . short_channel_id ) , None ) ;
@@ -450,7 +450,7 @@ fn test_onion_failure() {
450450 } , |msg| {
451451 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
452452 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
453- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
453+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
454454 } , ||{
455455 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
456456 } , true , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 0 ] . pubkey , is_permanent : true } ) , Some ( route. paths [ 0 ] . hops [ 0 ] . short_channel_id ) , Some ( next_hop_failure. clone ( ) ) ) ;
@@ -459,7 +459,7 @@ fn test_onion_failure() {
459459 run_onion_failure_test_with_fail_intercept ( "required_node_feature_missing" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
460460 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
461461 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
462- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
462+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
463463 } , ||{
464464 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
465465 } , false , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] . hops [ 1 ] . pubkey , is_permanent : true } ) , Some ( route. paths [ 0 ] . hops [ 1 ] . short_channel_id ) , None ) ;
@@ -489,7 +489,7 @@ fn test_onion_failure() {
489489 } , |msg| {
490490 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
491491 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
492- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , UPDATE |7 , & err_data) ;
492+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , UPDATE |7 , & err_data) ;
493493 } , ||{ } , true , Some ( UPDATE |7 ) ,
494494 Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : false } ) ,
495495 Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
@@ -501,7 +501,7 @@ fn test_onion_failure() {
501501 } , |msg| {
502502 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
503503 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
504- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , UPDATE |7 , & err_data_without_type) ;
504+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , UPDATE |7 , & err_data_without_type) ;
505505 } , ||{ } , true , Some ( UPDATE |7 ) ,
506506 Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : false } ) ,
507507 Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
@@ -512,7 +512,7 @@ fn test_onion_failure() {
512512 } , |msg| {
513513 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
514514 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
515- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |8 , & [ 0 ; 0 ] ) ;
515+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |8 , & [ 0 ; 0 ] ) ;
516516 // short_channel_id from the processing node
517517 } , ||{ } , true , Some ( PERM |8 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
518518
@@ -522,7 +522,7 @@ fn test_onion_failure() {
522522 } , |msg| {
523523 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
524524 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
525- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |9 , & [ 0 ; 0 ] ) ;
525+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 0 ] . shared_secret . as_ref ( ) , PERM |9 , & [ 0 ; 0 ] ) ;
526526 // short_channel_id from the processing node
527527 } , ||{ } , true , Some ( PERM |9 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
528528
@@ -654,7 +654,7 @@ fn test_onion_failure() {
654654 // Tamper returning error message
655655 let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
656656 let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
657- msg. reason = onion_utils:: build_first_hop_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , 23 , & [ 0 ; 0 ] ) ;
657+ msg. reason = onion_utils:: build_failure_packet ( onion_keys[ 1 ] . shared_secret . as_ref ( ) , 23 , & [ 0 ; 0 ] ) ;
658658 } , ||{
659659 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
660660 } , true , Some ( 23 ) , None , None , None ) ;
0 commit comments