@@ -235,7 +235,7 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool, persister_fail
235235 _ => panic ! ( "Unexpected event" ) ,
236236 }
237237
238- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
238+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 ) ;
239239
240240 // Now set it to failed again...
241241 let ( _, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( & nodes[ 1 ] ) ;
@@ -308,7 +308,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
308308 let channel_id = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 2 ;
309309 let logger = test_utils:: TestLogger :: new ( ) ;
310310
311- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
311+ let ( payment_preimage_1, payment_hash_1 , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
312312
313313 // Now try to send a second payment which will fail to send
314314 let ( payment_preimage_2, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 1 ] ) ;
@@ -344,8 +344,9 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
344344 let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
345345 assert_eq ! ( events_3. len( ) , 1 ) ;
346346 match events_3[ 0 ] {
347- Event :: PaymentSent { ref payment_preimage } => {
347+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
348348 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
349+ assert_eq ! ( * payment_hash, payment_hash_1) ;
349350 } ,
350351 _ => panic ! ( "Unexpected event" ) ,
351352 }
@@ -436,8 +437,9 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
436437 let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
437438 assert_eq ! ( events_3. len( ) , 1 ) ;
438439 match events_3[ 0 ] {
439- Event :: PaymentSent { ref payment_preimage } => {
440+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
440441 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
442+ assert_eq ! ( * payment_hash, payment_hash_1) ;
441443 } ,
442444 _ => panic ! ( "Unexpected event" ) ,
443445 }
@@ -609,7 +611,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
609611 _ => panic ! ( "Unexpected event" ) ,
610612 }
611613
612- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
614+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
613615}
614616
615617#[ test]
@@ -729,7 +731,7 @@ fn test_monitor_update_fail_cs() {
729731 _ => panic ! ( "Unexpected event" ) ,
730732 } ;
731733
732- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage) ;
734+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage, our_payment_hash ) ;
733735}
734736
735737#[ test]
@@ -780,7 +782,7 @@ fn test_monitor_update_fail_no_rebroadcast() {
780782 _ => panic ! ( "Unexpected event" ) ,
781783 }
782784
783- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
785+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, our_payment_hash ) ;
784786}
785787
786788#[ test]
@@ -858,8 +860,8 @@ fn test_monitor_update_raa_while_paused() {
858860 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
859861 expect_payment_received ! ( nodes[ 1 ] , our_payment_hash_1, our_payment_secret_1, 1000000 ) ;
860862
861- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
862- claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage_2) ;
863+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, our_payment_hash_1 ) ;
864+ claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage_2, our_payment_hash_2 ) ;
863865}
864866
865867fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
@@ -1122,10 +1124,10 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
11221124 Event :: PaymentReceived { payment_hash, .. } => assert_eq ! ( payment_hash, payment_hash_4. unwrap( ) ) ,
11231125 _ => panic ! ( "Unexpected event" ) ,
11241126 } ;
1125- claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_4. unwrap ( ) ) ;
1127+ claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_4. unwrap ( ) , payment_hash_4 . unwrap ( ) ) ;
11261128 }
11271129
1128- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage_2) ;
1130+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage_2, payment_hash_2 ) ;
11291131}
11301132
11311133#[ test]
@@ -1341,9 +1343,9 @@ fn raa_no_response_awaiting_raa_state() {
13411343 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
13421344 expect_payment_received ! ( nodes[ 1 ] , payment_hash_3, payment_secret_3, 1000000 ) ;
13431345
1344- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
1345- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
1346- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_3) ;
1346+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 ) ;
1347+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
1348+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_3, payment_hash_3 ) ;
13471349}
13481350
13491351#[ test]
@@ -1362,7 +1364,7 @@ fn claim_while_disconnected_monitor_update_fail() {
13621364 let logger = test_utils:: TestLogger :: new ( ) ;
13631365
13641366 // Forward a payment for B to claim
1365- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1367+ let ( payment_preimage_1, payment_hash_1 , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
13661368
13671369 nodes[ 0 ] . node . peer_disconnected ( & nodes[ 1 ] . node . get_our_node_id ( ) , false ) ;
13681370 nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
@@ -1463,13 +1465,14 @@ fn claim_while_disconnected_monitor_update_fail() {
14631465 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
14641466 assert_eq ! ( events. len( ) , 1 ) ;
14651467 match events[ 0 ] {
1466- Event :: PaymentSent { ref payment_preimage } => {
1468+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
14671469 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
1470+ assert_eq ! ( * payment_hash, payment_hash_1) ;
14681471 } ,
14691472 _ => panic ! ( "Unexpected event" ) ,
14701473 }
14711474
1472- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
1475+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
14731476}
14741477
14751478#[ test]
@@ -1539,7 +1542,7 @@ fn monitor_failed_no_reestablish_response() {
15391542 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
15401543 expect_payment_received ! ( nodes[ 1 ] , payment_hash_1, payment_secret_1, 1000000 ) ;
15411544
1542- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
1545+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 ) ;
15431546}
15441547
15451548#[ test]
@@ -1640,8 +1643,8 @@ fn first_message_on_recv_ordering() {
16401643 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
16411644 expect_payment_received ! ( nodes[ 1 ] , payment_hash_2, payment_secret_2, 1000000 ) ;
16421645
1643- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
1644- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
1646+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 ) ;
1647+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
16451648}
16461649
16471650#[ test]
@@ -1662,7 +1665,7 @@ fn test_monitor_update_fail_claim() {
16621665 // Rebalance a bit so that we can send backwards from 3 to 2.
16631666 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
16641667
1665- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1668+ let ( payment_preimage_1, payment_hash , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
16661669
16671670 * nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = Some ( Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ) ;
16681671 assert ! ( nodes[ 1 ] . node. claim_funds( payment_preimage_1) ) ;
@@ -1715,7 +1718,7 @@ fn test_monitor_update_fail_claim() {
17151718 let bs_fulfill_update = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
17161719 nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_fulfill_update. update_fulfill_htlcs [ 0 ] ) ;
17171720 commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , bs_fulfill_update. commitment_signed, false ) ;
1718- expect_payment_sent ! ( nodes[ 0 ] , payment_preimage_1) ;
1721+ expect_payment_sent ! ( nodes[ 0 ] , payment_preimage_1, payment_hash ) ;
17191722
17201723 // Get the payment forwards, note that they were batched into one commitment update.
17211724 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
@@ -1828,7 +1831,7 @@ fn test_monitor_update_on_pending_forwards() {
18281831 nodes[ 0 ] . node . process_pending_htlc_forwards ( ) ;
18291832 expect_payment_received ! ( nodes[ 0 ] , payment_hash_2, payment_secret_2, 1000000 ) ;
18301833
1831- claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_2) ;
1834+ claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_2, payment_hash_2 ) ;
18321835}
18331836
18341837#[ test]
@@ -1845,7 +1848,7 @@ fn monitor_update_claim_fail_no_response() {
18451848 let logger = test_utils:: TestLogger :: new ( ) ;
18461849
18471850 // Forward a payment for B to claim
1848- let ( payment_preimage_1, _ , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1851+ let ( payment_preimage_1, payment_hash_1 , _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
18491852
18501853 // Now start forwarding a second payment, skipping the last RAA so B is in AwaitingRAA
18511854 let ( payment_preimage_2, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 1 ] ) ;
@@ -1887,13 +1890,14 @@ fn monitor_update_claim_fail_no_response() {
18871890 let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
18881891 assert_eq ! ( events. len( ) , 1 ) ;
18891892 match events[ 0 ] {
1890- Event :: PaymentSent { ref payment_preimage } => {
1893+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
18911894 assert_eq ! ( * payment_preimage, payment_preimage_1) ;
1895+ assert_eq ! ( * payment_hash, payment_hash_1) ;
18921896 } ,
18931897 _ => panic ! ( "Unexpected event" ) ,
18941898 }
18951899
1896- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
1900+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
18971901}
18981902
18991903// confirm_a_first and restore_b_before_conf are wholly unrelated to earlier bools and
@@ -2051,7 +2055,7 @@ fn test_path_paused_mpp() {
20512055 assert_eq ! ( events. len( ) , 1 ) ;
20522056 pass_along_path ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] , 200_000 , payment_hash. clone ( ) , Some ( payment_secret) , events. pop ( ) . unwrap ( ) , true , None ) ;
20532057
2054- claim_payment_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , false , payment_preimage) ;
2058+ claim_payment_along_route ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , false , payment_preimage, payment_hash ) ;
20552059}
20562060
20572061#[ test]
@@ -2143,7 +2147,7 @@ fn test_pending_update_fee_ack_on_reconnect() {
21432147 expect_pending_htlcs_forwardable ! ( nodes[ 0 ] ) ;
21442148 expect_payment_received ! ( nodes[ 0 ] , payment_hash, payment_secret, 1_000_000 ) ;
21452149
2146- claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage) ;
2150+ claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage, payment_hash ) ;
21472151}
21482152
21492153fn do_update_fee_resend_test ( deliver_update : bool , parallel_updates : bool ) {
@@ -2279,7 +2283,7 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) {
22792283 //
22802284 // Note that because, at the end, MonitorUpdateFailed is still set, the HTLC generated in (c)
22812285 // will not be freed from the holding cell.
2282- let ( payment_preimage_0, _ , _) = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 100000 ) ;
2286+ let ( payment_preimage_0, payment_hash_0 , _) = route_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , 100000 ) ;
22832287
22842288 let route = {
22852289 let net_graph_msg_handler = & nodes[ 0 ] . net_graph_msg_handler ;
@@ -2410,7 +2414,7 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) {
24102414 assert ! ( updates. update_fee. is_none( ) ) ;
24112415 assert_eq ! ( updates. update_fulfill_htlcs. len( ) , 1 ) ;
24122416 nodes[ 1 ] . node . handle_update_fulfill_htlc ( & nodes[ 0 ] . node . get_our_node_id ( ) , & updates. update_fulfill_htlcs [ 0 ] ) ;
2413- expect_payment_sent ! ( nodes[ 1 ] , payment_preimage_0) ;
2417+ expect_payment_sent ! ( nodes[ 1 ] , payment_preimage_0, payment_hash_0 ) ;
24142418 assert_eq ! ( updates. update_add_htlcs. len( ) , 1 ) ;
24152419 nodes[ 1 ] . node . handle_update_add_htlc ( & nodes[ 0 ] . node . get_our_node_id ( ) , & updates. update_add_htlcs [ 0 ] ) ;
24162420 updates. commitment_signed
@@ -2432,8 +2436,8 @@ fn do_channel_holding_cell_serialize(disconnect: bool, reload_a: bool) {
24322436 expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
24332437 expect_payment_received ! ( nodes[ 1 ] , payment_hash_2, payment_secret_2, 100000 ) ;
24342438
2435- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1) ;
2436- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2) ;
2439+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 ) ;
2440+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 ) ;
24372441}
24382442#[ test]
24392443fn channel_holding_cell_serialize ( ) {
@@ -2516,7 +2520,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
25162520 bs_updates = Some ( get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
25172521 assert_eq ! ( bs_updates. as_ref( ) . unwrap( ) . update_fulfill_htlcs. len( ) , 1 ) ;
25182522 nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_updates. as_ref ( ) . unwrap ( ) . update_fulfill_htlcs [ 0 ] ) ;
2519- expect_payment_sent ! ( nodes[ 0 ] , payment_preimage) ;
2523+ expect_payment_sent ! ( nodes[ 0 ] , payment_preimage, payment_hash ) ;
25202524 if htlc_status == HTLCStatusAtDupClaim :: Cleared {
25212525 commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , & bs_updates. as_ref( ) . unwrap( ) . commitment_signed, false ) ;
25222526 }
@@ -2542,7 +2546,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
25422546 bs_updates = Some ( get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
25432547 assert_eq ! ( bs_updates. as_ref( ) . unwrap( ) . update_fulfill_htlcs. len( ) , 1 ) ;
25442548 nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_updates. as_ref ( ) . unwrap ( ) . update_fulfill_htlcs [ 0 ] ) ;
2545- expect_payment_sent ! ( nodes[ 0 ] , payment_preimage) ;
2549+ expect_payment_sent ! ( nodes[ 0 ] , payment_preimage, payment_hash ) ;
25462550 }
25472551 if htlc_status != HTLCStatusAtDupClaim :: Cleared {
25482552 commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , & bs_updates. as_ref( ) . unwrap( ) . commitment_signed, false ) ;
0 commit comments