66use ln:: channelmanager:: { RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
77use ln:: channelmonitor:: ChannelMonitorUpdateErr ;
88use ln:: msgs;
9- use ln:: msgs:: ChannelMessageHandler ;
9+ use ln:: msgs:: { ChannelMessageHandler , LocalFeatures } ;
1010use util:: events:: { Event , EventsProvider , MessageSendEvent , MessageSendEventsProvider } ;
1111use util:: errors:: APIError ;
1212
@@ -18,8 +18,8 @@ use ln::functional_test_utils::*;
1818#[ test]
1919fn test_simple_monitor_permanent_update_fail ( ) {
2020 // Test that we handle a simple permanent monitor update failure
21- let mut nodes = create_network ( 2 ) ;
22- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
21+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
22+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
2323
2424 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
2525 let ( _, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -48,8 +48,8 @@ fn test_simple_monitor_permanent_update_fail() {
4848fn do_test_simple_monitor_temporary_update_fail ( disconnect : bool ) {
4949 // Test that we can recover from a simple temporary monitor update failure optionally with
5050 // a disconnect in between
51- let mut nodes = create_network ( 2 ) ;
52- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
51+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
52+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
5353
5454 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
5555 let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -147,8 +147,8 @@ fn do_test_monitor_temporary_update_fail(disconnect_count: usize) {
147147 // * We then walk through more message exchanges to get the original update_add_htlc
148148 // through, swapping message ordering based on disconnect_count & 8 and optionally
149149 // disconnect/reconnecting based on disconnect_count.
150- let mut nodes = create_network ( 2 ) ;
151- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
150+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
151+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
152152
153153 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
154154
@@ -473,8 +473,8 @@ fn test_monitor_temporary_update_fail_c() {
473473#[ test]
474474fn test_monitor_update_fail_cs ( ) {
475475 // Tests handling of a monitor update failure when processing an incoming commitment_signed
476- let mut nodes = create_network ( 2 ) ;
477- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
476+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
477+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
478478
479479 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
480480 let ( payment_preimage, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -552,8 +552,8 @@ fn test_monitor_update_fail_no_rebroadcast() {
552552 // Tests handling of a monitor update failure when no message rebroadcasting on
553553 // test_restore_channel_monitor() is required. Backported from
554554 // chanmon_fail_consistency fuzz tests.
555- let mut nodes = create_network ( 2 ) ;
556- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
555+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
556+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
557557
558558 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
559559 let ( payment_preimage_1, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -594,8 +594,8 @@ fn test_monitor_update_fail_no_rebroadcast() {
594594fn test_monitor_update_raa_while_paused ( ) {
595595 // Tests handling of an RAA while monitor updating has already been marked failed.
596596 // Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
597- let mut nodes = create_network ( 2 ) ;
598- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
597+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
598+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
599599
600600 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 5000000 ) ;
601601
@@ -661,9 +661,9 @@ fn test_monitor_update_raa_while_paused() {
661661
662662fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
663663 // Tests handling of a monitor update failure when processing an incoming RAA
664- let mut nodes = create_network ( 3 ) ;
665- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
666- let chan_2 = create_announced_chan_between_nodes ( & nodes, 1 , 2 ) ;
664+ 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 ( ) ) ;
667667
668668 // Rebalance a bit so that we can send backwards from 2 to 1.
669669 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -914,9 +914,9 @@ fn test_monitor_update_fail_reestablish() {
914914 // Simple test for message retransmission after monitor update failure on
915915 // channel_reestablish generating a monitor update (which comes from freeing holding cell
916916 // HTLCs).
917- let mut nodes = create_network ( 3 ) ;
918- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
919- create_announced_chan_between_nodes ( & nodes, 1 , 2 ) ;
917+ 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 ( ) ) ;
920920
921921 let ( our_payment_preimage, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1000000 ) ;
922922
@@ -992,8 +992,8 @@ fn raa_no_response_awaiting_raa_state() {
992992 // due to a previous monitor update failure, we still set AwaitingRemoteRevoke on the channel
993993 // in question (assuming it intends to respond with a CS after monitor updating is restored).
994994 // Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
995- let mut nodes = create_network ( 2 ) ;
996- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
995+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
996+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
997997
998998 let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
999999 let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -1105,8 +1105,8 @@ fn claim_while_disconnected_monitor_update_fail() {
11051105 // Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
11061106 // code introduced a regression in this test (specifically, this caught a removal of the
11071107 // channel_reestablish handling ensuring the order was sensical given the messages used).
1108- let mut nodes = create_network ( 2 ) ;
1109- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1108+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1109+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
11101110
11111111 // Forward a payment for B to claim
11121112 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
@@ -1220,8 +1220,8 @@ fn monitor_failed_no_reestablish_response() {
12201220 // response to a commitment_signed.
12211221 // Backported from chanmon_fail_consistency fuzz tests as it caught a long-standing
12221222 // debug_assert!() failure in channel_reestablish handling.
1223- let mut nodes = create_network ( 2 ) ;
1224- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1223+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1224+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
12251225
12261226 // Route the payment and deliver the initial commitment_signed (with a monitor update failure
12271227 // on receipt).
@@ -1286,8 +1286,8 @@ fn first_message_on_recv_ordering() {
12861286 // have no pending response but will want to send a RAA/CS (with the updates for the second
12871287 // payment applied).
12881288 // Backported from chanmon_fail_consistency fuzz tests as it caught a bug here.
1289- let mut nodes = create_network ( 2 ) ;
1290- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1289+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1290+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
12911291
12921292 // Route the first payment outbound, holding the last RAA for B until we are set up so that we
12931293 // can deliver it and fail the monitor update.
@@ -1371,9 +1371,9 @@ fn test_monitor_update_fail_claim() {
13711371 // update to claim the payment. We then send a payment C->B->A, making the forward of this
13721372 // payment from B to A fail due to the paused channel. Finally, we restore the channel monitor
13731373 // updating and claim the payment on B.
1374- let mut nodes = create_network ( 3 ) ;
1375- let chan_1 = create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1376- create_announced_chan_between_nodes ( & nodes, 1 , 2 ) ;
1374+ 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 ( ) ) ;
13771377
13781378 // Rebalance a bit so that we can send backwards from 3 to 2.
13791379 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -1441,9 +1441,9 @@ fn test_monitor_update_on_pending_forwards() {
14411441 // We do this with a simple 3-node network, sending a payment from A to C and one from C to A.
14421442 // The payment from A to C will be failed by C and pending a back-fail to A, while the payment
14431443 // from C to A will be pending a forward to A.
1444- let mut nodes = create_network ( 3 ) ;
1445- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1446- create_announced_chan_between_nodes ( & nodes, 1 , 2 ) ;
1444+ let mut nodes = create_network ( 3 , & [ None , None , None ] ) ;
1445+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
1446+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
14471447
14481448 // Rebalance a bit so that we can send backwards from 3 to 1.
14491449 send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -1505,8 +1505,8 @@ fn monitor_update_claim_fail_no_response() {
15051505 // to channel being AwaitingRAA).
15061506 // Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
15071507 // code was broken.
1508- let mut nodes = create_network ( 2 ) ;
1509- create_announced_chan_between_nodes ( & nodes, 0 , 1 ) ;
1508+ let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1509+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , LocalFeatures :: new ( ) , LocalFeatures :: new ( ) ) ;
15101510
15111511 // Forward a payment for B to claim
15121512 let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
0 commit comments