@@ -26,7 +26,7 @@ use ln::msgs;
2626use ln:: msgs:: { ChannelMessageHandler , RoutingMessageHandler } ;
2727use util:: config:: UserConfig ;
2828use util:: enforcing_trait_impls:: EnforcingSigner ;
29- use util:: events:: { Event , MessageSendEvent , MessageSendEventsProvider , PaymentPurpose , ClosureReason } ;
29+ use util:: events:: { Event , MessageSendEvent , MessageSendEventsProvider , PaymentPurpose , ClosureReason , HTLCDestination } ;
3030use util:: errors:: APIError ;
3131use util:: ser:: { ReadableArgs , Writeable } ;
3232use util:: test_utils:: TestBroadcaster ;
@@ -832,7 +832,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
832832
833833 // Fail the payment backwards, failing the monitor update on nodes[1]'s receipt of the RAA
834834 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash_1) ;
835- expect_pending_htlcs_forwardable ! ( nodes[ 2 ] ) ;
835+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 2 ] , vec! [ HTLCDestination :: FailedPayment { payment_hash : payment_hash_1 } ] ) ;
836836 check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
837837
838838 let updates = get_htlc_update_msgs ! ( nodes[ 2 ] , nodes[ 1 ] . node. get_our_node_id( ) ) ;
@@ -913,7 +913,7 @@ fn do_test_monitor_update_fail_raa(test_ignore_second_cs: bool) {
913913 let ( outpoint, latest_update, _) = nodes[ 1 ] . chain_monitor . latest_monitor_update_id . lock ( ) . unwrap ( ) . get ( & chan_2. 2 ) . unwrap ( ) . clone ( ) ;
914914 nodes[ 1 ] . chain_monitor . chain_monitor . force_channel_monitor_updated ( outpoint, latest_update) ;
915915 check_added_monitors ! ( nodes[ 1 ] , 0 ) ;
916- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
916+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 1 ] , vec! [ HTLCDestination :: NextHopChannel { node_id : Some ( nodes [ 2 ] . node . get_our_node_id ( ) ) , channel_id : chan_2 . 2 } ] ) ;
917917 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
918918
919919 let mut events_3 = nodes[ 1 ] . node . get_and_clear_pending_msg_events ( ) ;
@@ -1690,14 +1690,14 @@ fn test_monitor_update_on_pending_forwards() {
16901690 let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ None , None , None ] ) ;
16911691 let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
16921692 let chan_1 = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1693- create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1693+ let chan_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
16941694
16951695 // Rebalance a bit so that we can send backwards from 3 to 1.
16961696 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
16971697
16981698 let ( _, payment_hash_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1000000 ) ;
16991699 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash_1) ;
1700- expect_pending_htlcs_forwardable ! ( nodes[ 2 ] ) ;
1700+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 2 ] , vec! [ HTLCDestination :: FailedPayment { payment_hash : payment_hash_1 } ] ) ;
17011701 check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
17021702
17031703 let cs_fail_update = get_htlc_update_msgs ! ( nodes[ 2 ] , nodes[ 1 ] . node. get_our_node_id( ) ) ;
@@ -1718,7 +1718,7 @@ fn test_monitor_update_on_pending_forwards() {
17181718 commitment_signed_dance ! ( nodes[ 1 ] , nodes[ 2 ] , payment_event. commitment_msg, false ) ;
17191719
17201720 chanmon_cfgs[ 1 ] . persister . set_update_ret ( Err ( ChannelMonitorUpdateErr :: TemporaryFailure ) ) ;
1721- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
1721+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 1 ] , vec! [ HTLCDestination :: NextHopChannel { node_id : Some ( nodes [ 2 ] . node . get_our_node_id ( ) ) , channel_id : chan_2 . 2 } ] ) ;
17221722 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
17231723 assert ! ( nodes[ 1 ] . node. get_and_clear_pending_msg_events( ) . is_empty( ) ) ;
17241724 nodes[ 1 ] . logger . assert_log ( "lightning::ln::channelmanager" . to_string ( ) , "Failed to update ChannelMonitor" . to_string ( ) , 1 ) ;
@@ -2106,7 +2106,7 @@ fn test_fail_htlc_on_broadcast_after_claim() {
21062106 check_closed_broadcast ! ( nodes[ 1 ] , true ) ;
21072107 connect_blocks ( & nodes[ 1 ] , ANTI_REORG_DELAY - 1 ) ;
21082108 check_added_monitors ! ( nodes[ 1 ] , 1 ) ;
2109- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
2109+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 1 ] , vec! [ HTLCDestination :: NextHopChannel { node_id : Some ( nodes [ 2 ] . node . get_our_node_id ( ) ) , channel_id : chan_id_2 } ] ) ;
21102110
21112111 nodes[ 0 ] . node . handle_update_fulfill_htlc ( & nodes[ 1 ] . node . get_our_node_id ( ) , & bs_updates. update_fulfill_htlcs [ 0 ] ) ;
21122112 expect_payment_sent_without_paths ! ( nodes[ 0 ] , payment_preimage) ;
@@ -2469,7 +2469,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
24692469 } ;
24702470 if second_fails {
24712471 nodes[ 2 ] . node . fail_htlc_backwards ( & payment_hash) ;
2472- expect_pending_htlcs_forwardable ! ( nodes[ 2 ] ) ;
2472+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 2 ] , vec! [ HTLCDestination :: FailedPayment { payment_hash } ] ) ;
24732473 check_added_monitors ! ( nodes[ 2 ] , 1 ) ;
24742474 get_htlc_update_msgs ! ( nodes[ 2 ] , nodes[ 1 ] . node. get_our_node_id( ) ) ;
24752475 } else {
@@ -2505,7 +2505,7 @@ fn do_test_reconnect_dup_htlc_claims(htlc_status: HTLCStatusAtDupClaim, second_f
25052505
25062506 if second_fails {
25072507 reconnect_nodes ( & nodes[ 1 ] , & nodes[ 2 ] , ( false , false ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 1 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
2508- expect_pending_htlcs_forwardable ! ( nodes[ 1 ] ) ;
2508+ expect_pending_htlcs_forwardable_and_htlc_handling_failed ! ( nodes[ 1 ] , vec! [ HTLCDestination :: NextHopChannel { node_id : Some ( nodes [ 2 ] . node . get_our_node_id ( ) ) , channel_id : chan_id_2 } ] ) ;
25092509 } else {
25102510 reconnect_nodes ( & nodes[ 1 ] , & nodes[ 2 ] , ( false , false ) , ( 0 , 0 ) , ( 1 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( 0 , 0 ) , ( false , false ) ) ;
25112511 }
0 commit comments