@@ -2521,8 +2521,8 @@ fn test_htlc_on_chain_success() {
25212521 send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
25222522 send_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 8000000 ) ;
25232523
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 ) ;
25262526
25272527 // Broadcast legit commitment tx from C on B's chain
25282528 // 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() {
26822682 let mut first_claimed = false ;
26832683 for event in events {
26842684 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 {
26872687 assert ! ( !first_claimed) ;
26882688 first_claimed = true ;
26892689 } else {
26902690 assert_eq ! ( payment_preimage, our_payment_preimage_2) ;
2691+ assert_eq ! ( payment_hash, payment_hash_2) ;
26912692 }
26922693 } ,
26932694 Event :: ChannelClosed { reason : ClosureReason :: CommitmentTxConfirmed , .. } => { } ,
@@ -3370,7 +3371,7 @@ fn test_simple_peer_disconnect() {
33703371 nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
33713372 reconnect_nodes ( & nodes[ 0 ] , & nodes[ 1 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
33723373
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 ) ;
33743375 let payment_preimage_4 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 0 ;
33753376 let payment_hash_5 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
33763377 let payment_hash_6 = route_payment ( & nodes[ 0 ] , & vec ! ( & nodes[ 1 ] , & nodes[ 2 ] ) [ ..] , 1000000 ) . 1 ;
@@ -3386,8 +3387,9 @@ fn test_simple_peer_disconnect() {
33863387 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
33873388 assert_eq ! ( events. len( ) , 2 ) ;
33883389 match events[ 0 ] {
3389- Event :: PaymentSent { payment_preimage } => {
3390+ Event :: PaymentSent { payment_preimage, payment_hash } => {
33903391 assert_eq ! ( payment_preimage, payment_preimage_3) ;
3392+ assert_eq ! ( payment_hash, payment_hash_3) ;
33913393 } ,
33923394 _ => panic ! ( "Unexpected event" ) ,
33933395 }
@@ -3554,8 +3556,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
35543556 let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
35553557 assert_eq ! ( events_4. len( ) , 1 ) ;
35563558 match events_4[ 0 ] {
3557- Event :: PaymentSent { ref payment_preimage } => {
3559+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
35583560 assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3561+ assert_eq ! ( payment_hash_1, * payment_hash) ;
35593562 } ,
35603563 _ => panic ! ( "Unexpected event" ) ,
35613564 }
@@ -3594,8 +3597,9 @@ fn do_test_drop_messages_peer_disconnect(messages_delivered: u8, simulate_broken
35943597 let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
35953598 assert_eq ! ( events_4. len( ) , 1 ) ;
35963599 match events_4[ 0 ] {
3597- Event :: PaymentSent { ref payment_preimage } => {
3600+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
35983601 assert_eq ! ( payment_preimage_1, * payment_preimage) ;
3602+ assert_eq ! ( payment_hash_1, * payment_hash) ;
35993603 } ,
36003604 _ => panic ! ( "Unexpected event" ) ,
36013605 }
@@ -3800,7 +3804,7 @@ fn test_drop_messages_peer_disconnect_dual_htlc() {
38003804 create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
38013805 let logger = test_utils:: TestLogger :: new ( ) ;
38023806
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 ) ;
38043808
38053809 // Now try to send a second payment which will fail to send
38063810 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() {
38343838 let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
38353839 assert_eq ! ( events_3. len( ) , 1 ) ;
38363840 match events_3[ 0 ] {
3837- Event :: PaymentSent { ref payment_preimage } => {
3841+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
38383842 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
3843+ assert_eq ! ( * payment_hash, payment_hash_1) ;
38393844 } ,
38403845 _ => panic ! ( "Unexpected event" ) ,
38413846 }
@@ -5251,8 +5256,9 @@ fn test_duplicate_payment_hash_one_failure_one_success() {
52515256
52525257 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
52535258 match events[ 0 ] {
5254- Event :: PaymentSent { ref payment_preimage } => {
5259+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
52555260 assert_eq ! ( * payment_preimage, our_payment_preimage) ;
5261+ assert_eq ! ( * payment_hash, duplicate_payment_hash) ;
52565262 }
52575263 _ => panic ! ( "Unexpected event" ) ,
52585264 }
@@ -5754,7 +5760,7 @@ fn do_htlc_claim_local_commitment_only(use_dust: bool) {
57545760 let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
57555761 let chan = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
57565762
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 } ) ;
57585764
57595765 // Claim the payment, but don't deliver A's commitment_signed, resulting in the HTLC only being
57605766 // 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) {
57665772 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
57675773 assert_eq ! ( events. len( ) , 1 ) ;
57685774 match events[ 0 ] {
5769- Event :: PaymentSent { payment_preimage } => {
5775+ Event :: PaymentSent { payment_preimage, payment_hash } => {
57705776 assert_eq ! ( payment_preimage, our_payment_preimage) ;
5777+ assert_eq ! ( payment_hash, our_payment_hash) ;
57715778 } ,
57725779 _ => panic ! ( "Unexpected event" ) ,
57735780 }
@@ -6201,8 +6208,9 @@ fn test_free_and_fail_holding_cell_htlcs() {
62016208 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
62026209 assert_eq ! ( events. len( ) , 1 ) ;
62036210 match events[ 0 ] {
6204- Event :: PaymentSent { ref payment_preimage } => {
6211+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
62056212 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
6213+ assert_eq ! ( * payment_hash, payment_hash_1) ;
62066214 }
62076215 _ => panic ! ( "Unexpected event" ) ,
62086216 }
0 commit comments