@@ -174,8 +174,8 @@ fn run_onion_failure_test_with_fail_intercept<F1,F2,F3>(_name: &str, test_case:
174
174
panic ! ( "channel_update not found!" ) ;
175
175
}
176
176
} ,
177
- & NetworkUpdate :: ChannelClosed { ref short_channel_id, ref is_permanent } => {
178
- if let NetworkUpdate :: ChannelClosed { short_channel_id : ref expected_short_channel_id, is_permanent : ref expected_is_permanent } = expected_channel_update. unwrap ( ) {
177
+ & NetworkUpdate :: ChannelFailure { ref short_channel_id, ref is_permanent } => {
178
+ if let NetworkUpdate :: ChannelFailure { short_channel_id : ref expected_short_channel_id, is_permanent : ref expected_is_permanent } = expected_channel_update. unwrap ( ) {
179
179
assert ! ( * short_channel_id == * expected_short_channel_id) ;
180
180
assert ! ( * is_permanent == * expected_is_permanent) ;
181
181
} else {
@@ -280,7 +280,7 @@ fn test_fee_failures() {
280
280
let short_channel_id = channels[ 0 ] . 0 . contents . short_channel_id ;
281
281
run_onion_failure_test ( "fee_insufficient" , 0 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
282
282
msg. amount_msat -= 1 ;
283
- } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
283
+ } , || { } , true , Some ( UPDATE |12 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
284
284
285
285
// In an earlier version, we spuriously failed to forward payments if the expected feerate
286
286
// changed between the channel open and the payment.
@@ -340,7 +340,7 @@ fn test_onion_failure() {
340
340
// describing a length-1 TLV payload, which is obviously bogus.
341
341
new_payloads[ 0 ] . data [ 0 ] = 1 ;
342
342
msg. onion_routing_packet = onion_utils:: construct_onion_packet_bogus_hopdata ( new_payloads, onion_keys, [ 0 ; 32 ] , & payment_hash) ;
343
- } , ||{ } , true , Some ( PERM |22 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
343
+ } , ||{ } , true , Some ( PERM |22 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
344
344
345
345
// final node failure
346
346
let short_channel_id = channels[ 1 ] . 0 . contents . short_channel_id ;
@@ -357,7 +357,7 @@ fn test_onion_failure() {
357
357
// length-1 TLV payload, which is obviously bogus.
358
358
new_payloads[ 1 ] . data [ 0 ] = 1 ;
359
359
msg. onion_routing_packet = onion_utils:: construct_onion_packet_bogus_hopdata ( new_payloads, onion_keys, [ 0 ; 32 ] , & payment_hash) ;
360
- } , ||{ } , false , Some ( PERM |22 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
360
+ } , ||{ } , false , Some ( PERM |22 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
361
361
362
362
// the following three with run_onion_failure_test_with_fail_intercept() test only the origin node
363
363
// receiving simulated fail messages
@@ -452,7 +452,7 @@ fn test_onion_failure() {
452
452
let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
453
453
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 0 ] . shared_secret [ ..] , PERM |8 , & [ 0 ; 0 ] ) ;
454
454
// short_channel_id from the processing node
455
- } , ||{ } , true , Some ( PERM |8 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
455
+ } , ||{ } , true , Some ( PERM |8 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
456
456
457
457
let short_channel_id = channels[ 1 ] . 0 . contents . short_channel_id ;
458
458
run_onion_failure_test_with_fail_intercept ( "required_channel_feature_missing" , 100 , & nodes, & route, & payment_hash, & payment_secret, |msg| {
@@ -462,13 +462,13 @@ fn test_onion_failure() {
462
462
let onion_keys = onion_utils:: construct_onion_keys ( & Secp256k1 :: new ( ) , & route. paths [ 0 ] , & session_priv) . unwrap ( ) ;
463
463
msg. reason = onion_utils:: build_first_hop_failure_packet ( & onion_keys[ 0 ] . shared_secret [ ..] , PERM |9 , & [ 0 ; 0 ] ) ;
464
464
// short_channel_id from the processing node
465
- } , ||{ } , true , Some ( PERM |9 ) , Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
465
+ } , ||{ } , true , Some ( PERM |9 ) , Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
466
466
467
467
let mut bogus_route = route. clone ( ) ;
468
468
bogus_route. paths [ 0 ] [ 1 ] . short_channel_id -= 1 ;
469
469
let short_channel_id = bogus_route. paths [ 0 ] [ 1 ] . short_channel_id ;
470
470
run_onion_failure_test ( "unknown_next_peer" , 0 , & nodes, & bogus_route, & payment_hash, & payment_secret, |_| { } , ||{ } , true , Some ( PERM |10 ) ,
471
- Some ( NetworkUpdate :: ChannelClosed { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
471
+ Some ( NetworkUpdate :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
472
472
473
473
let short_channel_id = channels[ 1 ] . 0 . contents . short_channel_id ;
474
474
let amt_to_forward = nodes[ 1 ] . node . channel_state . lock ( ) . unwrap ( ) . by_id . get ( & channels[ 1 ] . 2 ) . unwrap ( ) . get_counterparty_htlc_minimum_msat ( ) - 1 ;
@@ -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 :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
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 :: ChannelFailure { short_channel_id, is_permanent : true } ) , Some ( short_channel_id) ) ;
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| {
0 commit comments