@@ -281,7 +281,7 @@ fn test_fee_failures() {
281
281
let short_channel_id = channels[ 0 ] . 0 . contents . short_channel_id ;
282
282
run_onion_failure_test ( "fee_insufficient" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
283
283
msg. amount_msat -= 1 ;
284
- } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id ) ) ;
284
+ } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , None ) ;
285
285
286
286
// In an earlier version, we spuriously failed to forward payments if the expected feerate
287
287
// changed between the channel open and the payment.
@@ -373,7 +373,7 @@ fn test_onion_failure() {
373
373
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
374
374
let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
375
375
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 0 ] . shared_secret [ ..] , NODE |2 , & [ 0 ; 0 ] ) ;
376
- } , ||{ } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : false } ) , Some ( route . paths [ 0 ] [ 0 ] . short_channel_id ) ) ;
376
+ } , ||{ } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : false } ) , None ) ;
377
377
378
378
// final node failure
379
379
run_onion_failure_test_with_fail_intercept ( "temporary_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
@@ -383,7 +383,7 @@ fn test_onion_failure() {
383
383
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 1 ] . shared_secret [ ..] , NODE |2 , & [ 0 ; 0 ] ) ;
384
384
} , ||{
385
385
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
386
- } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : false } ) , Some ( route . paths [ 0 ] [ 1 ] . short_channel_id ) ) ;
386
+ } , true , Some ( NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : false } ) , None ) ;
387
387
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ! ( nodes[ 2 ] ) ;
388
388
389
389
// intermediate node failure
@@ -393,7 +393,7 @@ fn test_onion_failure() {
393
393
let session_priv = SecretKey :: from_slice ( & [ 3 ; 32 ] ) . unwrap ( ) ;
394
394
let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
395
395
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 0 ] . shared_secret [ ..] , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
396
- } , ||{ } , true , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : true } ) , Some ( route . paths [ 0 ] [ 0 ] . short_channel_id ) ) ;
396
+ } , ||{ } , true , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : true } ) , None ) ;
397
397
398
398
// final node failure
399
399
run_onion_failure_test_with_fail_intercept ( "permanent_node_failure" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
@@ -402,7 +402,7 @@ fn test_onion_failure() {
402
402
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 1 ] . shared_secret [ ..] , PERM |NODE |2 , & [ 0 ; 0 ] ) ;
403
403
} , ||{
404
404
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
405
- } , false , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : true } ) , Some ( route . paths [ 0 ] [ 1 ] . short_channel_id ) ) ;
405
+ } , false , Some ( PERM |NODE |2 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : true } ) , None ) ;
406
406
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ! ( nodes[ 2 ] ) ;
407
407
408
408
// intermediate node failure
@@ -414,7 +414,7 @@ fn test_onion_failure() {
414
414
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 0 ] . shared_secret [ ..] , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
415
415
} , ||{
416
416
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
417
- } , true , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : true } ) , Some ( route . paths [ 0 ] [ 0 ] . short_channel_id ) ) ;
417
+ } , true , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : true } ) , None ) ;
418
418
419
419
// final node failure
420
420
run_onion_failure_test_with_fail_intercept ( "required_node_feature_missing" , 200 , & nodes, & route, & payment_hash, & payment_secret, |_msg| { } , |msg| {
@@ -423,7 +423,7 @@ fn test_onion_failure() {
423
423
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 1 ] . shared_secret [ ..] , PERM |NODE |3 , & [ 0 ; 0 ] ) ;
424
424
} , ||{
425
425
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
426
- } , false , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : true } ) , Some ( route . paths [ 0 ] [ 1 ] . short_channel_id ) ) ;
426
+ } , false , Some ( PERM |NODE |3 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 1 ] . pubkey , is_permanent : true } ) , None ) ;
427
427
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ! ( nodes[ 2 ] ) ;
428
428
429
429
run_onion_failure_test ( "invalid_onion_version" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| { msg. onion_routing_packet . version = 1 ; } , ||{ } , true ,
@@ -487,13 +487,13 @@ fn test_onion_failure() {
487
487
let short_channel_id = channels[ 0 ] . 0 . contents . short_channel_id ;
488
488
run_onion_failure_test ( "fee_insufficient" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
489
489
msg. amount_msat -= 1 ;
490
- } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id ) ) ;
490
+ } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , None ) ;
491
491
492
492
let short_channel_id = channels[ 0 ] . 0 . contents . short_channel_id ;
493
493
run_onion_failure_test ( "incorrect_cltv_expiry" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
494
494
// need to violate: cltv_expiry - cltv_expiry_delta >= outgoing_cltv_value
495
495
msg. cltv_expiry -= 1 ;
496
- } , || { } , true , Some ( UPDATE |13 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id ) ) ;
496
+ } , || { } , true , Some ( UPDATE |13 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , None ) ;
497
497
498
498
let short_channel_id = channels[ 1 ] . 0 . contents . short_channel_id ;
499
499
run_onion_failure_test ( "expiry_too_soon" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
@@ -505,15 +505,15 @@ fn test_onion_failure() {
505
505
506
506
run_onion_failure_test ( "unknown_payment_hash" , 2 , & nodes, & route, & payment_hash, & payment_secret, |_| { } , || {
507
507
nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
508
- } , false , Some ( PERM |15 ) , None , Some ( channels [ 1 ] . 0 . contents . short_channel_id ) ) ;
508
+ } , false , Some ( PERM |15 ) , None , None ) ;
509
509
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ! ( nodes[ 2 ] ) ;
510
510
511
511
run_onion_failure_test ( "final_expiry_too_soon" , 1 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
512
512
let height = msg. cltv_expiry - CLTV_CLAIM_BUFFER - LATENCY_GRACE_PERIOD_BLOCKS + 1 ;
513
513
connect_blocks ( & nodes[ 0 ] , height - nodes[ 0 ] . best_block_info ( ) . 1 ) ;
514
514
connect_blocks ( & nodes[ 1 ] , height - nodes[ 1 ] . best_block_info ( ) . 1 ) ;
515
515
connect_blocks ( & nodes[ 2 ] , height - nodes[ 2 ] . best_block_info ( ) . 1 ) ;
516
- } , || { } , true , Some ( 17 ) , None , Some ( channels [ 1 ] . 0 . contents . short_channel_id ) ) ;
516
+ } , || { } , true , Some ( 17 ) , None , None ) ;
517
517
518
518
run_onion_failure_test ( "final_incorrect_cltv_expiry" , 1 , & nodes, & route, & payment_hash, & payment_secret, |_| { } , || {
519
519
for ( _, pending_forwards) in nodes[ 1 ] . node . channel_state . lock ( ) . unwrap ( ) . forward_htlcs . iter_mut ( ) {
@@ -560,5 +560,3 @@ fn test_onion_failure() {
560
560
msg. onion_routing_packet = onion_packet;
561
561
} , ||{ } , true , Some ( 21 ) , Some ( NetworkUpdate :: NodeFailure { node_id : route. paths [ 0 ] [ 0 ] . pubkey , is_permanent : true } ) , Some ( route. paths [ 0 ] [ 0 ] . short_channel_id ) ) ;
562
562
}
563
-
564
-
0 commit comments