@@ -922,40 +922,6 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
922
922
commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 0 ] , send_event. commitment_msg, false , true ) ;
923
923
check_added_monitors ! ( nodes[ 1 ] , 0 ) ;
924
924
925
- let mut events_2 = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
926
- assert_eq ! ( events_2. len( ) , 1 ) ;
927
- match events_2. remove ( 0 ) {
928
- MessageSendEvent :: UpdateHTLCs { node_id, updates } => {
929
- assert_eq ! ( node_id, nodes[ 0 ] . node. get_our_node_id( ) ) ;
930
- assert ! ( updates. update_fulfill_htlcs. is_empty( ) ) ;
931
- assert_eq ! ( updates. update_fail_htlcs. len( ) , 1 ) ;
932
- assert ! ( updates. update_fail_malformed_htlcs. is_empty( ) ) ;
933
- assert ! ( updates. update_add_htlcs. is_empty( ) ) ;
934
- assert ! ( updates. update_fee. is_none( ) ) ;
935
-
936
- nodes[ 0 ] . node . handle_update_fail_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & updates. update_fail_htlcs [ 0 ] ) ;
937
- commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , updates. commitment_signed, false , true ) ;
938
-
939
- let msg_events = nodes[ 0 ] . node . get_and_clear_pending_msg_events ( ) ;
940
- assert_eq ! ( msg_events. len( ) , 1 ) ;
941
- match msg_events[ 0 ] {
942
- MessageSendEvent :: PaymentFailureNetworkUpdate { update : msgs:: HTLCFailChannelUpdate :: ChannelUpdateMessage { ref msg } } => {
943
- assert_eq ! ( msg. contents. short_channel_id, chan_2. 0 . contents. short_channel_id) ;
944
- assert_eq ! ( msg. contents. flags & 2 , 2 ) ; // temp disabled
945
- } ,
946
- _ => panic ! ( "Unexpected event" ) ,
947
- }
948
-
949
- let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
950
- assert_eq ! ( events. len( ) , 1 ) ;
951
- if let Event :: PaymentFailed { payment_hash, rejected_by_dest, .. } = events[ 0 ] {
952
- assert_eq ! ( payment_hash, payment_hash_3) ;
953
- assert ! ( !rejected_by_dest) ;
954
- } else { panic ! ( "Unexpected event!" ) ; }
955
- } ,
956
- _ => panic ! ( "Unexpected event type!" ) ,
957
- } ;
958
-
959
925
let ( payment_preimage_4, payment_hash_4) = if test_ignore_second_cs {
960
926
// Try to route another payment backwards from 2 to make sure 1 holds off on responding
961
927
let ( payment_preimage_4, payment_hash_4, payment_secret_4) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -971,10 +937,15 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
971
937
assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
972
938
nodes[ 1 ] . logger . assert_log ( "lightning::ln::channelmanager" . to_string ( ) , "Previous monitor update failure prevented generation of RAA" . to_string ( ) , 1 ) ;
973
939
assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
974
- assert ! ( nodes[ 1 ] . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
975
940
( Some ( payment_preimage_4) , Some ( payment_hash_4) )
976
941
} else { ( None , None ) } ;
977
942
943
+ // Call forward_pending_htlcs first to make sure we don't have any issues attempting (and
944
+ // failing) to forward an HTLC while a channel is still awaiting monitor update restoration.
945
+ expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
946
+ check_added_monitors ! ( nodes[ 1 ] , 0 ) ;
947
+ assert ! ( nodes[ 1 ] . node. get_and_clear_pending_events( ) . is_empty( ) ) ;
948
+
978
949
// Restore monitor updating, ensuring we immediately get a fail-back update and a
979
950
// update_add update.
980
951
* nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = Some ( Ok ( ( ) ) ) ;
@@ -1021,14 +992,10 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
1021
992
1022
993
nodes[ 0 ] . node . handle_update_fail_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & messages_a. 0 ) ;
1023
994
commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , messages_a. 1 , false ) ;
1024
- let events_4 = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
1025
- assert_eq ! ( events_4. len( ) , 1 ) ;
1026
- if let Event :: PaymentFailed { payment_hash, rejected_by_dest, .. } = events_4[ 0 ] {
1027
- assert_eq ! ( payment_hash, payment_hash_1) ;
1028
- assert ! ( rejected_by_dest) ;
1029
- } else { panic ! ( "Unexpected event!" ) ; }
995
+ expect_payment_failed ! ( nodes[ 0 ] , payment_hash_1, true ) ;
1030
996
1031
997
nodes[ 2 ] . node . handle_update_add_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & send_event_b. msgs [ 0 ] ) ;
998
+ let as_cs;
1032
999
if test_ignore_second_cs {
1033
1000
nodes[ 2 ] . node . handle_commitment_signed ( & nodes[ 1 ] . node . get_our_node_id ( ) , & send_event_b. commitment_msg ) ;
1034
1001
check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
@@ -1044,40 +1011,83 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
1044
1011
1045
1012
nodes[ 1 ] . node . handle_revoke_and_ack ( & nodes[ 2 ] . node . get_our_node_id ( ) , & bs_revoke_and_ack) ;
1046
1013
check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1047
- let as_cs = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1048
- assert ! ( as_cs. update_add_htlcs. is_empty( ) ) ;
1014
+ as_cs = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1015
+
1016
+ nodes[ 1 ] . node . handle_commitment_signed ( & nodes[ 2 ] . node . get_our_node_id ( ) , & bs_cs. commitment_signed ) ;
1017
+ check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1018
+ } else {
1019
+ nodes[ 2 ] . node . handle_commitment_signed ( & nodes[ 1 ] . node . get_our_node_id ( ) , & send_event_b. commitment_msg ) ;
1020
+ check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1021
+
1022
+ let bs_revoke_and_commit = nodes[ 2 ] . node . get_and_clear_pending_msg_events ( ) ;
1023
+ assert_eq ! ( bs_revoke_and_commit. len( ) , 2 ) ;
1024
+ match bs_revoke_and_commit[ 0 ] {
1025
+ MessageSendEvent :: SendRevokeAndACK { ref node_id, ref msg } => {
1026
+ assert_eq ! ( * node_id, nodes[ 1 ] . node. get_our_node_id( ) ) ;
1027
+ nodes[ 1 ] . node . handle_revoke_and_ack ( & nodes[ 2 ] . node . get_our_node_id ( ) , & msg) ;
1028
+ check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1029
+ } ,
1030
+ _ => panic ! ( "Unexpected event" ) ,
1031
+ }
1032
+
1033
+ as_cs = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1034
+
1035
+ match bs_revoke_and_commit[ 1 ] {
1036
+ MessageSendEvent :: UpdateHTLCs { ref node_id, ref updates } => {
1037
+ assert_eq ! ( * node_id, nodes[ 1 ] . node. get_our_node_id( ) ) ;
1038
+ assert ! ( updates. update_add_htlcs. is_empty( ) ) ;
1039
+ assert ! ( updates. update_fail_htlcs. is_empty( ) ) ;
1040
+ assert ! ( updates. update_fail_malformed_htlcs. is_empty( ) ) ;
1041
+ assert ! ( updates. update_fulfill_htlcs. is_empty( ) ) ;
1042
+ assert ! ( updates. update_fee. is_none( ) ) ;
1043
+ nodes[ 1 ] . node . handle_commitment_signed ( & nodes[ 2 ] . node . get_our_node_id ( ) , & updates. commitment_signed ) ;
1044
+ check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1045
+ } ,
1046
+ _ => panic ! ( "Unexpected event" ) ,
1047
+ }
1048
+ }
1049
+ assert_eq ! ( as_cs. update_add_htlcs. len( ) , 1 ) ;
1049
1050
assert ! ( as_cs. update_fail_htlcs. is_empty( ) ) ;
1050
1051
assert ! ( as_cs. update_fail_malformed_htlcs. is_empty( ) ) ;
1051
1052
assert ! ( as_cs. update_fulfill_htlcs. is_empty( ) ) ;
1052
1053
assert ! ( as_cs. update_fee. is_none( ) ) ;
1053
-
1054
- nodes[ 1 ] . node . handle_commitment_signed ( & nodes[ 2 ] . node . get_our_node_id ( ) , & bs_cs. commitment_signed ) ;
1055
- check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1056
1054
let as_raa = get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendRevokeAndACK , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1057
1055
1056
+
1057
+ nodes[ 2 ] . node . handle_update_add_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_cs. update_add_htlcs [ 0 ] ) ;
1058
1058
nodes[ 2 ] . node . handle_commitment_signed ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_cs. commitment_signed ) ;
1059
1059
check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1060
1060
let bs_second_raa = get_event_msg ! ( nodes[ 2 ] , MessageSendEvent :: SendRevokeAndACK , nodes[ 1 ] . node. get_our_node_id( ) ) ;
1061
1061
1062
1062
nodes[ 2 ] . node . handle_revoke_and_ack ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_raa) ;
1063
1063
check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1064
- assert ! ( nodes[ 2 ] . node. get_and_clear_pending_msg_events ( ) . is_empty ( ) ) ;
1064
+ let bs_second_cs = get_htlc_update_msgs ! ( nodes[ 2 ] , nodes [ 1 ] . node. get_our_node_id ( ) ) ;
1065
1065
1066
1066
nodes[ 1 ] . node . handle_revoke_and_ack ( & nodes[ 2 ] . node . get_our_node_id ( ) , & bs_second_raa) ;
1067
1067
check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1068
1068
assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
1069
- } else {
1070
- commitment_signed_dance ! ( nodes[ 2 ] , nodes[ 1 ] , send_event_b. commitment_msg, false ) ;
1071
- }
1069
+
1070
+ nodes[ 1 ] . node . handle_commitment_signed ( & nodes[ 2 ] . node . get_our_node_id ( ) , & bs_second_cs. commitment_signed ) ;
1071
+ check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1072
+ let as_second_raa = get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendRevokeAndACK , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1073
+
1074
+ nodes[ 2 ] . node . handle_revoke_and_ack ( & nodes[ 1 ] . node . get_our_node_id ( ) , & as_second_raa) ;
1075
+ check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1076
+ assert ! ( nodes[ 2 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
1077
+
1072
1078
1073
1079
expect_pending_htlcs_forwardable ! ( nodes[ 2 ] ) ;
1074
1080
1075
1081
let events_6 = nodes[ 2 ] . node . get_and_clear_pending_events ( ) ;
1076
- assert_eq ! ( events_6. len( ) , 1 ) ;
1082
+ assert_eq ! ( events_6. len( ) , 2 ) ;
1077
1083
match events_6[ 0 ] {
1078
1084
Event :: PaymentReceived { payment_hash, .. } => { assert_eq ! ( payment_hash, payment_hash_2) ; } ,
1079
1085
_ => panic ! ( "Unexpected event" ) ,
1080
1086
} ;
1087
+ match events_6[ 1 ] {
1088
+ Event :: PaymentReceived { payment_hash, .. } => { assert_eq ! ( payment_hash, payment_hash_3) ; } ,
1089
+ _ => panic ! ( "Unexpected event" ) ,
1090
+ } ;
1081
1091
1082
1092
if test_ignore_second_cs {
1083
1093
expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
@@ -1612,9 +1622,9 @@ fn first_message_on_recv_ordering() {
1612
1622
fn test_monitor_update_fail_claim ( ) {
1613
1623
// Basic test for monitor update failures when processing claim_funds calls.
1614
1624
// We set up a simple 3-node network, sending a payment from A to B and failing B's monitor
1615
- // update to claim the payment. We then send a payment C->B->A, making the forward of this
1616
- // payment from B to A fail due to the paused channel. Finally, we restore the channel monitor
1617
- // updating and claim the payment on B .
1625
+ // update to claim the payment. We then send two payments C->B->A, which are held at B.
1626
+ // Finally, we restore the channel monitor updating and claim the payment on B, forwarding
1627
+ // the payments from C onwards to A .
1618
1628
let chanmon_cfgs = create_chanmon_cfgs ( 3 ) ;
1619
1629
let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
1620
1630
let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
@@ -1630,12 +1640,19 @@ fn test_monitor_update_fail_claim() {
1630
1640
1631
1641
* nodes[ 1 ] . chain_monitor . update_ret . lock ( ) . unwrap ( ) = Some ( Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ) ;
1632
1642
assert ! ( nodes[ 1 ] . node. claim_funds( payment_preimage_1) ) ;
1643
+ nodes[ 1 ] . logger . assert_log ( "lightning::ln::channelmanager" . to_string ( ) , "Temporary failure claiming HTLC, treating as success: Failed to update ChannelMonitor" . to_string ( ) , 1 ) ;
1633
1644
check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1634
1645
1646
+ // Note that at this point there is a pending commitment transaction update for A being held by
1647
+ // B. Even when we go to send the payment from C through B to A, B will not update this
1648
+ // already-signed commitment transaction and will instead wait for it to resolve before
1649
+ // forwarding the payment onwards.
1650
+
1635
1651
let ( _, payment_hash_2, payment_secret_2) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
1652
+ let route;
1636
1653
{
1637
1654
let net_graph_msg_handler = & nodes[ 2 ] . net_graph_msg_handler ;
1638
- let route = get_route ( & nodes[ 2 ] . node . get_our_node_id ( ) , & net_graph_msg_handler. network_graph . read ( ) . unwrap ( ) , & nodes[ 0 ] . node . get_our_node_id ( ) , Some ( InvoiceFeatures :: known ( ) ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV , & logger) . unwrap ( ) ;
1655
+ route = get_route ( & nodes[ 2 ] . node . get_our_node_id ( ) , & net_graph_msg_handler. network_graph . read ( ) . unwrap ( ) , & nodes[ 0 ] . node . get_our_node_id ( ) , Some ( InvoiceFeatures :: known ( ) ) , None , & Vec :: new ( ) , 1_000_000 , TEST_FINAL_CLTV , & logger) . unwrap ( ) ;
1639
1656
nodes[ 2 ] . node . send_payment ( & route, payment_hash_2, & Some ( payment_secret_2) ) . unwrap ( ) ;
1640
1657
check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1641
1658
}
@@ -1650,29 +1667,19 @@ fn test_monitor_update_fail_claim() {
1650
1667
nodes[ 1 ] . node . handle_update_add_htlc ( & nodes[ 2 ] . node . get_our_node_id ( ) , & payment_event. msgs [ 0 ] ) ;
1651
1668
let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
1652
1669
assert_eq ! ( events. len( ) , 0 ) ;
1653
- nodes[ 1 ] . logger . assert_log ( "lightning::ln::channelmanager" . to_string ( ) , "Temporary failure claiming HTLC, treating as success: Failed to update ChannelMonitor" . to_string ( ) , 1 ) ;
1654
1670
commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 2 ] , payment_event. commitment_msg, false , true ) ;
1655
1671
1656
- let bs_fail_update = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 2 ] . node. get_our_node_id( ) ) ;
1657
- nodes[ 2 ] . node . handle_update_fail_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_fail_update. update_fail_htlcs [ 0 ] ) ;
1658
- commitment_signed_dance ! ( nodes[ 2 ] , nodes[ 1 ] , bs_fail_update. commitment_signed, false , true ) ;
1659
-
1660
- let msg_events = nodes[ 2 ] . node . get_and_clear_pending_msg_events ( ) ;
1661
- assert_eq ! ( msg_events. len( ) , 1 ) ;
1662
- match msg_events[ 0 ] {
1663
- MessageSendEvent :: PaymentFailureNetworkUpdate { update : msgs:: HTLCFailChannelUpdate :: ChannelUpdateMessage { ref msg } } => {
1664
- assert_eq ! ( msg. contents. short_channel_id, chan_1. 0 . contents. short_channel_id) ;
1665
- assert_eq ! ( msg. contents. flags & 2 , 2 ) ; // temp disabled
1666
- } ,
1667
- _ => panic ! ( "Unexpected event" ) ,
1668
- }
1672
+ let ( _, payment_hash_3, payment_secret_3) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
1673
+ nodes[ 2 ] . node . send_payment ( & route, payment_hash_3, & Some ( payment_secret_3) ) . unwrap ( ) ;
1674
+ check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
1669
1675
1670
- let events = nodes[ 2 ] . node . get_and_clear_pending_events ( ) ;
1676
+ let mut events = nodes[ 2 ] . node . get_and_clear_pending_msg_events ( ) ;
1671
1677
assert_eq ! ( events. len( ) , 1 ) ;
1672
- if let Event :: PaymentFailed { payment_hash, rejected_by_dest, .. } = events[ 0 ] {
1673
- assert_eq ! ( payment_hash, payment_hash_2) ;
1674
- assert ! ( !rejected_by_dest) ;
1675
- } else { panic ! ( "Unexpected event!" ) ; }
1678
+ let payment_event = SendEvent :: from_event ( events. pop ( ) . unwrap ( ) ) ;
1679
+ nodes[ 1 ] . node . handle_update_add_htlc ( & nodes[ 2 ] . node . get_our_node_id ( ) , & payment_event. msgs [ 0 ] ) ;
1680
+ let events = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
1681
+ assert_eq ! ( events. len( ) , 0 ) ;
1682
+ commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 2 ] , payment_event. commitment_msg, false , true ) ;
1676
1683
1677
1684
// Now restore monitor updating on the 0<->1 channel and claim the funds on B.
1678
1685
let ( outpoint, latest_update) = nodes[ 1 ] . chain_monitor . latest_monitor_update_id . lock ( ) . unwrap ( ) . get ( & chan_1. 2 ) . unwrap ( ) . clone ( ) ;
@@ -1682,12 +1689,37 @@ fn test_monitor_update_fail_claim() {
1682
1689
let bs_fulfill_update = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
1683
1690
nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_fulfill_update. update_fulfill_htlcs [ 0 ] ) ;
1684
1691
commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , bs_fulfill_update. commitment_signed, false ) ;
1692
+ expect_payment_sent ! ( nodes[ 0 ] , payment_preimage_1) ;
1693
+
1694
+ // Get the payment forwards, note that they were batched into one commitment update.
1695
+ expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
1696
+ check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
1697
+ let bs_forward_update = get_htlc_update_msgs ! ( nodes[ 1 ] , nodes[ 0 ] . node. get_our_node_id( ) ) ;
1698
+ nodes[ 0 ] . node . handle_update_add_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_forward_update. update_add_htlcs [ 0 ] ) ;
1699
+ nodes[ 0 ] . node . handle_update_add_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_forward_update. update_add_htlcs [ 1 ] ) ;
1700
+ commitment_signed_dance ! ( nodes[ 0 ] , nodes[ 1 ] , bs_forward_update. commitment_signed, false ) ;
1701
+ expect_pending_htlcs_forwardable ! ( nodes[ 0 ] ) ;
1685
1702
1686
1703
let events = nodes[ 0 ] . node . get_and_clear_pending_events ( ) ;
1687
- assert_eq ! ( events. len( ) , 1 ) ;
1688
- if let Event :: PaymentSent { payment_preimage, .. } = events[ 0 ] {
1689
- assert_eq ! ( payment_preimage, payment_preimage_1) ;
1690
- } else { panic ! ( "Unexpected event!" ) ; }
1704
+ assert_eq ! ( events. len( ) , 2 ) ;
1705
+ match events[ 0 ] {
1706
+ Event :: PaymentReceived { ref payment_hash, ref payment_preimage, ref payment_secret, amt, user_payment_id : _ } => {
1707
+ assert_eq ! ( payment_hash_2, * payment_hash) ;
1708
+ assert ! ( payment_preimage. is_none( ) ) ;
1709
+ assert_eq ! ( payment_secret_2, * payment_secret) ;
1710
+ assert_eq ! ( 1_000_000 , amt) ;
1711
+ } ,
1712
+ _ => panic ! ( "Unexpected event" ) ,
1713
+ }
1714
+ match events[ 1 ] {
1715
+ Event :: PaymentReceived { ref payment_hash, ref payment_preimage, ref payment_secret, amt, user_payment_id : _ } => {
1716
+ assert_eq ! ( payment_hash_3, * payment_hash) ;
1717
+ assert ! ( payment_preimage. is_none( ) ) ;
1718
+ assert_eq ! ( payment_secret_3, * payment_secret) ;
1719
+ assert_eq ! ( 1_000_000 , amt) ;
1720
+ } ,
1721
+ _ => panic ! ( "Unexpected event" ) ,
1722
+ }
1691
1723
}
1692
1724
1693
1725
#[ test]
0 commit comments