@@ -2481,8 +2481,8 @@ fn test_htlc_on_chain_success() {
2481
2481
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2482
2482
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2483
2483
2484
- let ( our_payment_preimage, _payment_hash , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2485
- let ( our_payment_preimage_2, _payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2484
+ let ( our_payment_preimage, payment_hash_1 , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2485
+ let ( our_payment_preimage_2, payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2486
2486
2487
2487
// Broadcast legit commitment tx from C on B's chain
2488
2488
// Broadcast HTLC Success transaction by C on received output from C's commitment tx on B's chain
@@ -2636,12 +2636,13 @@ fn test_htlc_on_chain_success() {
2636
2636
let mut first_claimed = false ;
2637
2637
for event in events {
2638
2638
match event {
2639
- Event :: PaymentSent { payment_preimage } => {
2640
- if payment_preimage == our_payment_preimage {
2639
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
2640
+ if payment_preimage == our_payment_preimage && payment_hash == payment_hash_1 {
2641
2641
assert ! ( !first_claimed) ;
2642
2642
first_claimed = true ;
2643
2643
} else {
2644
2644
assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2645
+ assert_eq ! ( payment_hash, payment_hash_2) ;
2645
2646
}
2646
2647
} ,
2647
2648
_ => 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, 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 ! ( 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 ! ( 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, payment_hash_1) ;
3768
3773
} ,
3769
3774
_ => panic ! ( "Unexpected event" ) ,
3770
3775
}
@@ -5150,8 +5155,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
5150
5155
5151
5156
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5152
5157
match events[ 0 ] {
5153
- Event :: PaymentSent { ref payment_preimage } => {
5158
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
5154
5159
assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5160
+ assert_eq ! ( * payment_hash, duplicate_payment_hash) ;
5155
5161
}
5156
5162
_ => panic ! ( "Unexpected event" ) ,
5157
5163
}
@@ -5631,7 +5637,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5631
5637
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
5632
5638
let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
5633
5639
5634
- let ( our_payment_preimage, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5640
+ let ( our_payment_preimage, our_payment_hash , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5635
5641
5636
5642
// Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
5637
5643
// present in B's local commitment transaction, but none of A's commitment transactions.
@@ -5643,8 +5649,9 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5643
5649
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5644
5650
assert_eq ! ( events. len( ) , 1 ) ;
5645
5651
match events[ 0 ] {
5646
- Event :: PaymentSent { payment_preimage } => {
5652
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
5647
5653
assert_eq ! ( payment_preimage, our_payment_preimage) ;
5654
+ assert_eq ! ( payment_hash, our_payment_hash) ;
5648
5655
} ,
5649
5656
_ => panic ! ( "Unexpected event" ) ,
5650
5657
}
@@ -6075,8 +6082,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
6075
6082
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
6076
6083
assert_eq ! ( events. len( ) , 1 ) ;
6077
6084
match events[ 0 ] {
6078
- Event :: PaymentSent { ref payment_preimage } => {
6085
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
6079
6086
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6087
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
6080
6088
}
6081
6089
_ => panic ! ( "Unexpected event" ) ,
6082
6090
}
0 commit comments