55
66use ln:: channelmanager:: { RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
77use ln:: channelmonitor:: ChannelMonitorUpdateErr ;
8+ use ln:: features:: InitFeatures ;
89use ln:: msgs;
9- use ln:: msgs:: { ChannelMessageHandler , LocalFeatures , RoutingMessageHandler , ErrorAction } ;
10+ use ln:: msgs:: { ChannelMessageHandler , ErrorAction , RoutingMessageHandler } ;
1011use util:: events:: { Event , EventsProvider , MessageSendEvent , MessageSendEventsProvider } ;
1112use util:: errors:: APIError ;
1213
@@ -19,7 +20,7 @@ use ln::functional_test_utils::*;
1920fn test_simple_monitor_permanent_update_fail ( ) {
2021 // Test that we handle a simple permanent monitor update failure
2122 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
22- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
23+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
2324
2425 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
2526 let ( _, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -49,7 +50,7 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool) {
4950 // Test that we can recover from a simple temporary monitor update failure optionally with
5051 // a disconnect in between
5152 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
52- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
53+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
5354
5455 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
5556 let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -148,7 +149,7 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
148149 // through, swapping message ordering based on disconnect_count & 8 and optionally
149150 // disconnect/reconnecting based on disconnect_count.
150151 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
151- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
152+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
152153
153154 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
154155
@@ -474,7 +475,7 @@ fn test_monitor_temporary_update_fail_c() {
474475fn test_monitor_update_fail_cs ( ) {
475476 // Tests handling of a monitor update failure when processing an incoming commitment_signed
476477 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
477- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
478+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
478479
479480 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
480481 let ( payment_preimage, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -553,7 +554,7 @@ fn test_monitor_update_fail_no_rebroadcast() {
553554 // test_restore_channel_monitor() is required. Backported from
554555 // chanmon_fail_consistency fuzz tests.
555556 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
556- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
557+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
557558
558559 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
559560 let ( payment_preimage_1, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -595,7 +596,7 @@ fn test_monitor_update_raa_while_paused() {
595596 // Tests handling of an RAA while monitor updating has already been marked failed.
596597 // Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
597598 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
598- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
599+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
599600
600601 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 5000000 , 5_000_000 ) ;
601602
@@ -662,8 +663,8 @@ fn test_monitor_update_raa_while_paused() {
662663fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
663664 // Tests handling of a monitor update failure when processing an incoming RAA
664665 let mut nodes = create_network ( 3 , & [ None , None , None ] ) ;
665- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
666- let chan_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
666+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
667+ let chan_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
667668
668669 // Rebalance a bit so that we can send backwards from 2 to 1.
669670 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -915,8 +916,8 @@ fn test_monitor_update_fail_reestablish() {
915916 // channel_reestablish generating a monitor update (which comes from freeing holding cell
916917 // HTLCs).
917918 let mut nodes = create_network ( 3 , & [ None , None , None ] ) ;
918- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
919- create_announced_chan_between_nodes ( & nodes, 1 , 2 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
919+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
920+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
920921
921922 let ( our_payment_preimage, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1000000 ) ;
922923
@@ -993,7 +994,7 @@ fn raa_no_response_awaiting_raa_state() {
993994 // in question (assuming it intends to respond with a CS after monitor updating is restored).
994995 // Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
995996 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
996- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
997+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
997998
998999 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
9991000 let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -1106,7 +1107,7 @@ fn claim_while_disconnected_monitor_update_fail() {
11061107 // code introduced a regression in this test (specifically, this caught a removal of the
11071108 // channel_reestablish handling ensuring the order was sensical given the messages used).
11081109 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1109- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1110+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
11101111
11111112 // Forward a payment for B to claim
11121113 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
@@ -1221,7 +1222,7 @@ fn monitor_failed_no_reestablish_response() {
12211222 // Backported from chanmon_fail_consistency fuzz tests as it caught a long-standing
12221223 // debug_assert!() failure in channel_reestablish handling.
12231224 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1224- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1225+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
12251226
12261227 // Route the payment and deliver the initial commitment_signed (with a monitor update failure
12271228 // on receipt).
@@ -1287,7 +1288,7 @@ fn first_message_on_recv_ordering() {
12871288 // payment applied).
12881289 // Backported from chanmon_fail_consistency fuzz tests as it caught a bug here.
12891290 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1290- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1291+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
12911292
12921293 // Route the first payment outbound, holding the last RAA for B until we are set up so that we
12931294 // can deliver it and fail the monitor update.
@@ -1372,8 +1373,8 @@ fn test_monitor_update_fail_claim() {
13721373 // payment from B to A fail due to the paused channel. Finally, we restore the channel monitor
13731374 // updating and claim the payment on B.
13741375 let mut nodes = create_network ( 3 , & [ None , None , None ] ) ;
1375- let chan_1 = create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1376- create_announced_chan_between_nodes ( & nodes, 1 , 2 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1376+ let chan_1 = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
1377+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
13771378
13781379 // Rebalance a bit so that we can send backwards from 3 to 2.
13791380 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -1445,8 +1446,8 @@ fn test_monitor_update_on_pending_forwards() {
14451446 // The payment from A to C will be failed by C and pending a back-fail to A, while the payment
14461447 // from C to A will be pending a forward to A.
14471448 let mut nodes = create_network ( 3 , & [ None , None , None ] ) ;
1448- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1449- create_announced_chan_between_nodes ( & nodes, 1 , 2 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1449+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
1450+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
14501451
14511452 // Rebalance a bit so that we can send backwards from 3 to 1.
14521453 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -1510,7 +1511,7 @@ fn monitor_update_claim_fail_no_response() {
15101511 // Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
15111512 // code was broken.
15121513 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1513- create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1514+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: supported ( ) , InitFeatures :: supported ( ) ) ;
15141515
15151516 // Forward a payment for B to claim
15161517 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
@@ -1571,8 +1572,8 @@ fn do_during_funding_monitor_fail(fail_on_generate: bool, restore_between_fails:
15711572 let mut nodes = create_network ( 2 , & [ None , None ] ) ;
15721573
15731574 nodes[ 0 ] . node . create_channel ( nodes[ 1 ] . node . get_our_node_id ( ) , 100000 , 10001 , 43 ) . unwrap ( ) ;
1574- nodes[ 1 ] . node . handle_open_channel ( & nodes[ 0 ] . node . get_our_node_id ( ) , LocalFeatures :: new ( ) , & get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendOpenChannel , nodes[ 1 ] . node. get_our_node_id( ) ) ) ;
1575- nodes[ 0 ] . node . handle_accept_channel ( & nodes[ 1 ] . node . get_our_node_id ( ) , LocalFeatures :: new ( ) , & get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendAcceptChannel , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
1575+ nodes[ 1 ] . node . handle_open_channel ( & nodes[ 0 ] . node . get_our_node_id ( ) , InitFeatures :: supported ( ) , & get_event_msg ! ( nodes[ 0 ] , MessageSendEvent :: SendOpenChannel , nodes[ 1 ] . node. get_our_node_id( ) ) ) ;
1576+ nodes[ 0 ] . node . handle_accept_channel ( & nodes[ 1 ] . node . get_our_node_id ( ) , InitFeatures :: supported ( ) , & get_event_msg ! ( nodes[ 1 ] , MessageSendEvent :: SendAcceptChannel , nodes[ 0 ] . node. get_our_node_id( ) ) ) ;
15761577
15771578 let ( temporary_channel_id, funding_tx, funding_output) = create_funding_transaction ( & nodes[ 0 ] , 100000 , 43 ) ;
15781579
0 commit comments