@@ -2521,8 +2521,8 @@ fn test_htlc_on_chain_success() {
2521
2521
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2522
2522
send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
2523
2523
2524
- let ( our_payment_preimage, _payment_hash , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2525
- let ( our_payment_preimage_2, _payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2524
+ let ( our_payment_preimage, payment_hash_1 , _payment_secret) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2525
+ let ( our_payment_preimage_2, payment_hash_2 , _payment_secret_2) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) , 3000000 ) ;
2526
2526
2527
2527
// Broadcast legit commitment tx from C on B's chain
2528
2528
// Broadcast HTLC Success transaction by C on received output from C's commitment tx on B's chain
@@ -2682,12 +2682,13 @@ fn test_htlc_on_chain_success() {
2682
2682
let mut first_claimed = false ;
2683
2683
for event in events {
2684
2684
match event {
2685
- Event :: PaymentSent { payment_preimage } => {
2686
- if payment_preimage == our_payment_preimage {
2685
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
2686
+ if payment_preimage == our_payment_preimage && payment_hash == payment_hash_1 {
2687
2687
assert ! ( !first_claimed) ;
2688
2688
first_claimed = true ;
2689
2689
} else {
2690
2690
assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2691
+ assert_eq ! ( payment_hash, payment_hash_2) ;
2691
2692
}
2692
2693
} ,
2693
2694
Event :: ChannelClosed { reason : ClosureReason :: CommitmentTxConfirmed , .. } => { } ,
@@ -3370,7 +3371,7 @@ fn test_simple_peer_disconnect() {
3370
3371
nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
3371
3372
reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
3372
3373
3373
- let payment_preimage_3 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
3374
+ let ( payment_preimage_3, payment_hash_3 , _ ) = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) ;
3374
3375
let payment_preimage_4 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
3375
3376
let payment_hash_5 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
3376
3377
let payment_hash_6 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
@@ -3386,8 +3387,9 @@ fn test_simple_peer_disconnect() {
3386
3387
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3387
3388
assert_eq ! ( events. len( ) , 2 ) ;
3388
3389
match events[ 0 ] {
3389
- Event :: PaymentSent { payment_preimage } => {
3390
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
3390
3391
assert_eq ! ( payment_preimage, payment_preimage_3) ;
3392
+ assert_eq ! ( payment_hash, payment_hash_3) ;
3391
3393
} ,
3392
3394
_ => panic ! ( "Unexpected event" ) ,
3393
3395
}
@@ -3554,8 +3556,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
3554
3556
let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3555
3557
assert_eq ! ( events_4. len( ) , 1 ) ;
3556
3558
match events_4[ 0 ] {
3557
- Event :: PaymentSent { ref payment_preimage } => {
3559
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3558
3560
assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3561
+ assert_eq ! ( payment_hash_1, * payment_hash) ;
3559
3562
} ,
3560
3563
_ => panic ! ( "Unexpected event" ) ,
3561
3564
}
@@ -3594,8 +3597,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
3594
3597
let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3595
3598
assert_eq ! ( events_4. len( ) , 1 ) ;
3596
3599
match events_4[ 0 ] {
3597
- Event :: PaymentSent { ref payment_preimage } => {
3600
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3598
3601
assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3602
+ assert_eq ! ( payment_hash_1, * payment_hash) ;
3599
3603
} ,
3600
3604
_ => panic ! ( "Unexpected event" ) ,
3601
3605
}
@@ -3800,7 +3804,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
3800
3804
create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
3801
3805
let logger = test_utils:: TestLogger :: new ( ) ;
3802
3806
3803
- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
3807
+ let ( payment_preimage_1, payment_hash_1 , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
3804
3808
3805
3809
// Now try to send a second payment which will fail to send
3806
3810
let ( payment_preimage_2, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 1 ] ) ;
@@ -3834,8 +3838,9 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
3834
3838
let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
3835
3839
assert_eq ! ( events_3. len( ) , 1 ) ;
3836
3840
match events_3[ 0 ] {
3837
- Event :: PaymentSent { ref payment_preimage } => {
3841
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
3838
3842
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
3843
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
3839
3844
} ,
3840
3845
_ => panic ! ( "Unexpected event" ) ,
3841
3846
}
@@ -5251,8 +5256,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
5251
5256
5252
5257
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5253
5258
match events[ 0 ] {
5254
- Event :: PaymentSent { ref payment_preimage } => {
5259
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
5255
5260
assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5261
+ assert_eq ! ( * payment_hash, duplicate_payment_hash) ;
5256
5262
}
5257
5263
_ => panic ! ( "Unexpected event" ) ,
5258
5264
}
@@ -5754,7 +5760,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5754
5760
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
5755
5761
let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
5756
5762
5757
- let ( our_payment_preimage, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5763
+ let ( our_payment_preimage, our_payment_hash , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , if use_dust { 50000 } else { 3000000 } ) ;
5758
5764
5759
5765
// Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
5760
5766
// present in B's local commitment transaction, but none of A's commitment transactions.
@@ -5766,8 +5772,9 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
5766
5772
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
5767
5773
assert_eq ! ( events. len( ) , 1 ) ;
5768
5774
match events[ 0 ] {
5769
- Event :: PaymentSent { payment_preimage } => {
5775
+ Event :: PaymentSent { payment_preimage, payment_hash } => {
5770
5776
assert_eq ! ( payment_preimage, our_payment_preimage) ;
5777
+ assert_eq ! ( payment_hash, our_payment_hash) ;
5771
5778
} ,
5772
5779
_ => panic ! ( "Unexpected event" ) ,
5773
5780
}
@@ -6201,8 +6208,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
6201
6208
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
6202
6209
assert_eq ! ( events. len( ) , 1 ) ;
6203
6210
match events[ 0 ] {
6204
- Event :: PaymentSent { ref payment_preimage } => {
6211
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
6205
6212
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6213
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
6206
6214
}
6207
6215
_ => panic ! ( "Unexpected event" ) ,
6208
6216
}
0 commit comments