@@ -2481,8 +2481,8 @@ fn test_htlc_on_chain_success() {
24812481 send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
24822482 send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
24832483
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 ) ;
24862486
24872487 // Broadcast legit commitment tx from C on B's chain
24882488 // 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() {
26362636 let mut first_claimed = false ;
26372637 for event in events {
26382638 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 == Some ( payment_hash_1 ) {
26412641 assert ! ( !first_claimed) ;
26422642 first_claimed = true ;
26432643 } else {
26442644 assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2645+ assert_eq ! ( payment_hash, Some ( payment_hash_2) ) ;
26452646 }
26462647 } ,
26472648 _ => panic ! ( "Unexpected event" ) ,
@@ -3299,7 +3300,7 @@ fn test_simple_peer_disconnect() {
32993300 nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
33003301 reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
33013302
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 ) ;
33033304 let payment_preimage_4 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
33043305 let payment_hash_5 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
33053306 let payment_hash_6 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
@@ -3315,8 +3316,9 @@ fn test_simple_peer_disconnect() {
33153316 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
33163317 assert_eq ! ( events. len( ) , 2 ) ;
33173318 match events[ 0 ] {
3318- Event :: PaymentSent { payment_preimage } => {
3319+ Event :: PaymentSent { payment_preimage, payment_hash } => {
33193320 assert_eq ! ( payment_preimage, payment_preimage_3) ;
3321+ assert_eq ! ( payment_hash, Some ( payment_hash_3) ) ;
33203322 } ,
33213323 _ => panic ! ( "Unexpected event" ) ,
33223324 }
@@ -3483,8 +3485,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
34833485 let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
34843486 assert_eq ! ( events_4. len( ) , 1 ) ;
34853487 match events_4[ 0 ] {
3486- Event :: PaymentSent { ref payment_preimage } => {
3488+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
34873489 assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3490+ assert_eq ! ( Some ( payment_hash_1) , * payment_hash) ;
34883491 } ,
34893492 _ => panic ! ( "Unexpected event" ) ,
34903493 }
@@ -3523,8 +3526,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
35233526 let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
35243527 assert_eq ! ( events_4. len( ) , 1 ) ;
35253528 match events_4[ 0 ] {
3526- Event :: PaymentSent { ref payment_preimage } => {
3529+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
35273530 assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3531+ assert_eq ! ( Some ( payment_hash_1) , * payment_hash) ;
35283532 } ,
35293533 _ => panic ! ( "Unexpected event" ) ,
35303534 }
@@ -3729,7 +3733,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
37293733 create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
37303734 let logger = test_utils:: TestLogger :: new ( ) ;
37313735
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 ) ;
37333737
37343738 // Now try to send a second payment which will fail to send
37353739 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() {
37633767 let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
37643768 assert_eq ! ( events_3. len( ) , 1 ) ;
37653769 match events_3[ 0 ] {
3766- Event :: PaymentSent { ref payment_preimage } => {
3770+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
37673771 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
3772+ assert_eq ! ( * payment_hash, Some ( payment_hash_1) ) ;
37683773 } ,
37693774 _ => panic ! ( "Unexpected event" ) ,
37703775 }
@@ -5150,8 +5155,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
51505155
51515156 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
51525157 match events[ 0 ] {
5153- Event :: PaymentSent { ref payment_preimage } => {
5158+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
51545159 assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5160+ assert_eq ! ( * payment_hash, Some ( duplicate_payment_hash) ) ;
51555161 }
51565162 _ => panic ! ( "Unexpected event" ) ,
51575163 }
@@ -5631,7 +5637,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
56315637 let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
56325638 let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
56335639
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 } ) ;
56355641
56365642 // Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
56375643 // 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) {
56435649 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
56445650 assert_eq ! ( events. len( ) , 1 ) ;
56455651 match events[ 0 ] {
5646- Event :: PaymentSent { payment_preimage } => {
5652+ Event :: PaymentSent { payment_preimage, payment_hash } => {
56475653 assert_eq ! ( payment_preimage, our_payment_preimage) ;
5654+ assert_eq ! ( payment_hash, Some ( our_payment_hash) ) ;
56485655 } ,
56495656 _ => panic ! ( "Unexpected event" ) ,
56505657 }
@@ -6075,8 +6082,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
60756082 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
60766083 assert_eq ! ( events. len( ) , 1 ) ;
60776084 match events[ 0 ] {
6078- Event :: PaymentSent { ref payment_preimage } => {
6085+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
60796086 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6087+ assert_eq ! ( * payment_hash, Some ( payment_hash_1) ) ;
60806088 }
60816089 _ => panic ! ( "Unexpected event" ) ,
60826090 }
0 commit comments