@@ -2632,12 +2632,13 @@ fn test_htlc_on_chain_success() {
26322632 let mut first_claimed = false ;
26332633 for event in events {
26342634 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 ) {
26372637 assert ! ( !first_claimed) ;
26382638 first_claimed = true ;
26392639 } else {
26402640 assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2641+ assert_eq ! ( payment_hash, Some ( _payment_hash_2) ) ;
26412642 }
26422643 } ,
26432644 _ => 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 }
@@ -5200,8 +5205,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
52005205
52015206 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
52025207 match events[ 0 ] {
5203- Event :: PaymentSent { ref payment_preimage } => {
5208+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
52045209 assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5210+ assert_eq ! ( * payment_hash, Some ( duplicate_payment_hash) ) ;
52055211 }
52065212 _ => panic ! ( "Unexpected event" ) ,
52075213 }
@@ -5682,7 +5688,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
56825688 let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
56835689 let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
56845690
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 } ) ;
56865692
56875693 // Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
56885694 // 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) {
56945700 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
56955701 assert_eq ! ( events. len( ) , 1 ) ;
56965702 match events[ 0 ] {
5697- Event :: PaymentSent { payment_preimage } => {
5703+ Event :: PaymentSent { payment_preimage, payment_hash } => {
56985704 assert_eq ! ( payment_preimage, our_payment_preimage) ;
5705+ assert_eq ! ( payment_hash, Some ( our_payment_hash) ) ;
56995706 } ,
57005707 _ => panic ! ( "Unexpected event" ) ,
57015708 }
@@ -6122,8 +6129,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
61226129 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
61236130 assert_eq ! ( events. len( ) , 1 ) ;
61246131 match events[ 0 ] {
6125- Event :: PaymentSent { ref payment_preimage } => {
6132+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
61266133 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6134+ assert_eq ! ( * payment_hash, Some ( payment_hash_1) ) ;
61276135 }
61286136 _ => panic ! ( "Unexpected event" ) ,
61296137 }
0 commit comments