@@ -2477,8 +2477,8 @@ fn test_htlc_on_chain_success() {
2477
2477
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2478
2478
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2479
2479
2480
- let ( our_payment_preimage, _payment_hash , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2481
- let ( our_payment_preimage_2, _payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2480
+ let ( our_payment_preimage, payment_hash_1 , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2481
+ let ( our_payment_preimage_2, payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2482
2482
2483
2483
// Broadcast legit commitment tx from C on B's chain
2484
2484
// Broadcast HTLC Success transaction by C on received output from C's commitment tx on B's chain
@@ -2632,12 +2632,13 @@ fn test_htlc_on_chain_success() {
2632
2632
let mut first_claimed = false ;
2633
2633
for event in events {
2634
2634
match event {
2635
- Event :: PaymentSent { payment_preimage } => {
2636
- if payment_preimage == our_payment_preimage {
2635
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
2636
+ if payment_preimage == our_payment_preimage && payment_hash == Some ( payment_hash_1 ) {
2637
2637
assert ! ( !first_claimed) ;
2638
2638
first_claimed = true ;
2639
2639
} else {
2640
2640
assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2641
+ assert_eq ! ( payment_hash, Some ( payment_hash_2) ) ;
2641
2642
}
2642
2643
} ,
2643
2644
_ => panic ! ( "Unexpected event" ) ,
@@ -3299,7 +3300,7 @@ fn test_simple_peer_disconnect() {
3299
3300
nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
3300
3301
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
3301
3302
3302
- let payment_preimage_3 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
3303
+ let ( payment_preimage_3, payment_hash_3 , _ ) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) ;
3303
3304
let payment_preimage_4 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
3304
3305
let payment_hash_5 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
3305
3306
let payment_hash_6 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
@@ -3315,8 +3316,9 @@ fn test_simple_peer_disconnect() {
3315
3316
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3316
3317
assert_eq ! ( events. len( ) , 2 ) ;
3317
3318
match events[ 0 ] {
3318
- Event :: PaymentSent { payment_preimage } => {
3319
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
3319
3320
assert_eq ! ( payment_preimage, payment_preimage_3) ;
3321
+ assert_eq ! ( payment_hash, Some ( payment_hash_3) ) ;
3320
3322
} ,
3321
3323
_ => panic ! ( "Unexpected event" ) ,
3322
3324
}
@@ -3483,8 +3485,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
3483
3485
let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3484
3486
assert_eq ! ( events_4. len( ) , 1 ) ;
3485
3487
match events_4[ 0 ] {
3486
- Event :: PaymentSent { ref payment_preimage } => {
3488
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3487
3489
assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3490
+ assert_eq ! ( Some ( payment_hash_1) , * payment_hash) ;
3488
3491
} ,
3489
3492
_ => panic ! ( "Unexpected event" ) ,
3490
3493
}
@@ -3523,8 +3526,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
3523
3526
let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3524
3527
assert_eq ! ( events_4. len( ) , 1 ) ;
3525
3528
match events_4[ 0 ] {
3526
- Event :: PaymentSent { ref payment_preimage } => {
3529
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3527
3530
assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3531
+ assert_eq ! ( Some ( payment_hash_1) , * payment_hash) ;
3528
3532
} ,
3529
3533
_ => panic ! ( "Unexpected event" ) ,
3530
3534
}
@@ -3729,7 +3733,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
3729
3733
create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
3730
3734
let logger = test_utils:: TestLogger :: new ( ) ;
3731
3735
3732
- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
3736
+ let ( payment_preimage_1, payment_hash_1 , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
3733
3737
3734
3738
// Now try to send a second payment which will fail to send
3735
3739
let ( payment_preimage_2, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 1 ] ) ;
@@ -3763,8 +3767,9 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
3763
3767
let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3764
3768
assert_eq ! ( events_3. len( ) , 1 ) ;
3765
3769
match events_3[ 0 ] {
3766
- Event :: PaymentSent { ref payment_preimage } => {
3770
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3767
3771
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
3772
+ assert_eq ! ( * payment_hash, Some ( payment_hash_1) ) ;
3768
3773
} ,
3769
3774
_ => panic ! ( "Unexpected event" ) ,
3770
3775
}
@@ -5200,8 +5205,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
5200
5205
5201
5206
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5202
5207
match events[ 0 ] {
5203
- Event :: PaymentSent { ref payment_preimage } => {
5208
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
5204
5209
assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5210
+ assert_eq ! ( * payment_hash, Some ( duplicate_payment_hash) ) ;
5205
5211
}
5206
5212
_ => panic ! ( "Unexpected event" ) ,
5207
5213
}
@@ -5682,7 +5688,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5682
5688
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
5683
5689
let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
5684
5690
5685
- let ( our_payment_preimage, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5691
+ let ( our_payment_preimage, our_payment_hash , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5686
5692
5687
5693
// Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
5688
5694
// present in B's local commitment transaction, but none of A's commitment transactions.
@@ -5694,8 +5700,9 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5694
5700
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5695
5701
assert_eq ! ( events. len( ) , 1 ) ;
5696
5702
match events[ 0 ] {
5697
- Event :: PaymentSent { payment_preimage } => {
5703
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
5698
5704
assert_eq ! ( payment_preimage, our_payment_preimage) ;
5705
+ assert_eq ! ( payment_hash, Some ( our_payment_hash) ) ;
5699
5706
} ,
5700
5707
_ => panic ! ( "Unexpected event" ) ,
5701
5708
}
@@ -6122,8 +6129,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
6122
6129
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
6123
6130
assert_eq ! ( events. len( ) , 1 ) ;
6124
6131
match events[ 0 ] {
6125
- Event :: PaymentSent { ref payment_preimage } => {
6132
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
6126
6133
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6134
+ assert_eq ! ( * payment_hash, Some ( payment_hash_1) ) ;
6127
6135
}
6128
6136
_ => panic ! ( "Unexpected event" ) ,
6129
6137
}
0 commit comments