@@ -411,15 +411,15 @@ fn test_onion_failure() {
411
411
// and tamper returning error message
412
412
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
413
413
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 ] ) ;
415
415
} , ||{ } , 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 ( ) ) ) ;
416
416
417
417
// final node failure
418
418
run_onion_failure_test_with_fail_intercept ( "temporary_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
419
419
// and tamper returning error message
420
420
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
421
421
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 ] ) ;
423
423
} , ||{
424
424
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
425
425
} , 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() {
431
431
} , |msg| {
432
432
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
433
433
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 ] ) ;
435
435
} , ||{ } , 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 ( ) ) ) ;
436
436
437
437
// final node failure
438
438
run_onion_failure_test_with_fail_intercept ( "permanent_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
439
439
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
440
440
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 ] ) ;
442
442
} , ||{
443
443
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
444
444
} , 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() {
450
450
} , |msg| {
451
451
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
452
452
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 ] ) ;
454
454
} , ||{
455
455
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
456
456
} , 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() {
459
459
run_onion_failure_test_with_fail_intercept ( "required_node_feature_missing" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
460
460
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
461
461
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 ] ) ;
463
463
} , ||{
464
464
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
465
465
} , 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() {
489
489
} , |msg| {
490
490
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
491
491
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) ;
493
493
} , ||{ } , true , Some ( UPDATE |7 ) ,
494
494
Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : false } ) ,
495
495
Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
@@ -501,7 +501,7 @@ fn test_onion_failure() {
501
501
} , |msg| {
502
502
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
503
503
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) ;
505
505
} , ||{ } , true , Some ( UPDATE |7 ) ,
506
506
Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : false } ) ,
507
507
Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
@@ -512,7 +512,7 @@ fn test_onion_failure() {
512
512
} , |msg| {
513
513
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
514
514
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 ] ) ;
516
516
// short_channel_id from the processing node
517
517
} , ||{ } , true , Some ( PERM |8 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
518
518
@@ -522,7 +522,7 @@ fn test_onion_failure() {
522
522
} , |msg| {
523
523
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
524
524
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 ] ) ;
526
526
// short_channel_id from the processing node
527
527
} , ||{ } , true , Some ( PERM |9 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) , Some ( next_hop_failure. clone ( ) ) ) ;
528
528
@@ -654,7 +654,7 @@ fn test_onion_failure() {
654
654
// Tamper returning error message
655
655
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
656
656
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 ] ) ;
658
658
} , ||{
659
659
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
660
660
} , true , Some ( 23 ) , None , None , None ) ;
0 commit comments