@@ -213,7 +213,7 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool, persister_fail
213
213
_ => panic ! ( "Unexpected event" ) ,
214
214
}
215
215
216
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
216
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 , 1_000_000 ) ;
217
217
218
218
// Now set it to failed again...
219
219
let ( _, payment_hash_2) = get_payment_preimage_hash ! ( & nodes[ 0 ] ) ;
@@ -286,7 +286,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
286
286
let channel_id = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) . 2 ;
287
287
let logger = test_utils:: TestLogger :: new ( ) ;
288
288
289
- let ( payment_preimage_1, _ ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
289
+ let ( payment_preimage_1, payment_hash_1 ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
290
290
291
291
// Now try to send a second payment which will fail to send
292
292
let ( payment_preimage_2, payment_hash_2) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -322,8 +322,9 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
322
322
let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
323
323
assert_eq ! ( events_3. len( ) , 1 ) ;
324
324
match events_3[ 0 ] {
325
- Event :: PaymentSent { ref payment_preimage } => {
325
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
326
326
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
327
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
327
328
} ,
328
329
_ => panic ! ( "Unexpected event" ) ,
329
330
}
@@ -414,8 +415,9 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
414
415
let events_3 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
415
416
assert_eq ! ( events_3. len( ) , 1 ) ;
416
417
match events_3[ 0 ] {
417
- Event :: PaymentSent { ref payment_preimage } => {
418
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
418
419
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
420
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
419
421
} ,
420
422
_ => panic ! ( "Unexpected event" ) ,
421
423
}
@@ -581,7 +583,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
581
583
_ => panic ! ( "Unexpected event" ) ,
582
584
}
583
585
584
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, 1_000_000 ) ;
586
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
585
587
}
586
588
587
589
#[ test]
@@ -695,7 +697,7 @@ fn test_monitor_update_fail_cs() {
695
697
_ => panic ! ( "Unexpected event" ) ,
696
698
} ;
697
699
698
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage, 1_000_000 ) ;
700
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage, our_payment_hash , 1_000_000 ) ;
699
701
}
700
702
701
703
#[ test]
@@ -746,7 +748,7 @@ fn test_monitor_update_fail_no_rebroadcast() {
746
748
_ => panic ! ( "Unexpected event" ) ,
747
749
}
748
750
749
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
751
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, our_payment_hash , 1_000_000 ) ;
750
752
}
751
753
752
754
#[ test]
@@ -824,8 +826,8 @@ fn test_monitor_update_raa_while_paused() {
824
826
expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
825
827
expect_payment_received ! ( nodes[ 1 ] , our_payment_hash_1, 1000000 ) ;
826
828
827
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
828
- claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage_2, 1_000_000 ) ;
829
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, our_payment_hash_1 , 1_000_000 ) ;
830
+ claim_payment ( & nodes[ 1 ] , & [ & nodes[ 0 ] ] , payment_preimage_2, our_payment_hash_2 , 1_000_000 ) ;
829
831
}
830
832
831
833
fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
@@ -1078,10 +1080,10 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
1078
1080
Event :: PaymentReceived { payment_hash, .. } => assert_eq ! ( payment_hash, payment_hash_4. unwrap( ) ) ,
1079
1081
_ => panic ! ( "Unexpected event" ) ,
1080
1082
} ;
1081
- claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_4. unwrap ( ) , 1_000_000 ) ;
1083
+ claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_4. unwrap ( ) , payment_hash_4 . unwrap ( ) , 1_000_000 ) ;
1082
1084
}
1083
1085
1084
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage_2, 1_000_000 ) ;
1086
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1085
1087
}
1086
1088
1087
1089
#[ test]
@@ -1288,9 +1290,9 @@ fn raa_no_response_awaiting_raa_state() {
1288
1290
expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
1289
1291
expect_payment_received ! ( nodes[ 1 ] , payment_hash_3, 1000000 ) ;
1290
1292
1291
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
1292
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, 1_000_000 ) ;
1293
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_3, 1_000_000 ) ;
1293
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 , 1_000_000 ) ;
1294
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1295
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_3, payment_hash_3 , 1_000_000 ) ;
1294
1296
}
1295
1297
1296
1298
#[ test]
@@ -1309,7 +1311,7 @@ fn claim_while_disconnected_monitor_update_fail() {
1309
1311
let logger = test_utils:: TestLogger :: new ( ) ;
1310
1312
1311
1313
// Forward a payment for B to claim
1312
- let ( payment_preimage_1, _ ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1314
+ let ( payment_preimage_1, payment_hash_1 ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1313
1315
1314
1316
nodes[ 0 ] . node . peer_disconnected ( & nodes[ 1 ] . node . get_our_node_id ( ) , false ) ;
1315
1317
nodes[ 1 ] . node . peer_disconnected ( & nodes[ 0 ] . node . get_our_node_id ( ) , false ) ;
@@ -1410,13 +1412,14 @@ fn claim_while_disconnected_monitor_update_fail() {
1410
1412
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
1411
1413
assert_eq ! ( events. len( ) , 1 ) ;
1412
1414
match events[ 0 ] {
1413
- Event :: PaymentSent { ref payment_preimage } => {
1415
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
1414
1416
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
1417
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
1415
1418
} ,
1416
1419
_ => panic ! ( "Unexpected event" ) ,
1417
1420
}
1418
1421
1419
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, 1_000_000 ) ;
1422
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1420
1423
}
1421
1424
1422
1425
#[ test]
@@ -1484,7 +1487,7 @@ fn monitor_failed_no_reestablish_response() {
1484
1487
expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
1485
1488
expect_payment_received ! ( nodes[ 1 ] , payment_hash_1, 1000000 ) ;
1486
1489
1487
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
1490
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 , 1_000_000 ) ;
1488
1491
}
1489
1492
1490
1493
#[ test]
@@ -1585,8 +1588,8 @@ fn first_message_on_recv_ordering() {
1585
1588
expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
1586
1589
expect_payment_received ! ( nodes[ 1 ] , payment_hash_2, 1000000 ) ;
1587
1590
1588
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, 1_000_000 ) ;
1589
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, 1_000_000 ) ;
1591
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_1, payment_hash_1 , 1_000_000 ) ;
1592
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1590
1593
}
1591
1594
1592
1595
#[ test]
@@ -1741,7 +1744,7 @@ fn test_monitor_update_on_pending_forwards() {
1741
1744
nodes[ 0 ] . node . process_pending_htlc_forwards ( ) ;
1742
1745
expect_payment_received ! ( nodes[ 0 ] , payment_hash_2, 1000000 ) ;
1743
1746
1744
- claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_2, 1_000_000 ) ;
1747
+ claim_payment ( & nodes[ 2 ] , & [ & nodes[ 1 ] , & nodes[ 0 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1745
1748
}
1746
1749
1747
1750
#[ test]
@@ -1758,7 +1761,7 @@ fn monitor_update_claim_fail_no_response() {
1758
1761
let logger = test_utils:: TestLogger :: new ( ) ;
1759
1762
1760
1763
// Forward a payment for B to claim
1761
- let ( payment_preimage_1, _ ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1764
+ let ( payment_preimage_1, payment_hash_1 ) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
1762
1765
1763
1766
// Now start forwarding a second payment, skipping the last RAA so B is in AwaitingRAA
1764
1767
let ( payment_preimage_2, payment_hash_2) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -1800,13 +1803,14 @@ fn monitor_update_claim_fail_no_response() {
1800
1803
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
1801
1804
assert_eq ! ( events. len( ) , 1 ) ;
1802
1805
match events[ 0 ] {
1803
- Event :: PaymentSent { ref payment_preimage } => {
1806
+ Event :: PaymentSent { ref payment_preimage, ref payment_hash } => {
1804
1807
assert_eq ! ( * payment_preimage, payment_preimage_1) ;
1808
+ assert_eq ! ( * payment_hash, payment_hash_1) ;
1805
1809
} ,
1806
1810
_ => panic ! ( "Unexpected event" ) ,
1807
1811
}
1808
1812
1809
- claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, 1_000_000 ) ;
1813
+ claim_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , payment_preimage_2, payment_hash_2 , 1_000_000 ) ;
1810
1814
}
1811
1815
1812
1816
// confirm_a_first and restore_b_before_conf are wholly unrelated to earlier bools and
@@ -1970,5 +1974,5 @@ fn test_path_paused_mpp() {
1970
1974
assert_eq ! ( events. len( ) , 1 ) ;
1971
1975
pass_along_path ( & nodes[ 0 ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] , 200_000 , payment_hash. clone ( ) , Some ( payment_secret) , events. pop ( ) . unwrap ( ) , true ) ;
1972
1976
1973
- claim_payment_along_route_with_secret ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , false , payment_preimage, Some ( payment_secret) , 200_000 ) ;
1977
+ claim_payment_along_route_with_secret ( & nodes[ 0 ] , & [ & [ & nodes[ 1 ] , & nodes[ 3 ] ] , & [ & nodes[ 2 ] , & nodes[ 3 ] ] ] , false , payment_preimage, payment_hash , Some ( payment_secret) , 200_000 ) ;
1974
1978
}
0 commit comments