5
5
6
6
use ln:: channelmanager:: { RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
7
7
use ln:: channelmonitor:: ChannelMonitorUpdateErr ;
8
+ use ln:: features:: InitFeatures ;
8
9
use ln:: msgs;
9
- use ln:: msgs:: { ChannelMessageHandler , LocalFeatures , RoutingMessageHandler , ErrorAction } ;
10
+ use ln:: msgs:: { ChannelMessageHandler , ErrorAction , RoutingMessageHandler } ;
10
11
use util:: events:: { Event , EventsProvider , MessageSendEvent , MessageSendEventsProvider } ;
11
12
use util:: errors:: APIError ;
12
13
@@ -19,7 +20,7 @@ use ln::functional_test_utils::*;
19
20
fn test_simple_monitor_permanent_update_fail ( ) {
20
21
// Test that we handle a simple permanent monitor update failure
21
22
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 ( ) ) ;
23
24
24
25
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
25
26
let ( _, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -49,7 +50,7 @@ fn do_test_simple_monitor_temporary_update_fail(disconnect: bool) {
49
50
// Test that we can recover from a simple temporary monitor update failure optionally with
50
51
// a disconnect in between
51
52
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 ( ) ) ;
53
54
54
55
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
55
56
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) {
148
149
// through, swapping message ordering based on disconnect_count & 8 and optionally
149
150
// disconnect/reconnecting based on disconnect_count.
150
151
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 ( ) ) ;
152
153
153
154
let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
154
155
@@ -474,7 +475,7 @@ fn test_monitor_temporary_update_fail_c() {
474
475
fn test_monitor_update_fail_cs ( ) {
475
476
// Tests handling of a monitor update failure when processing an incoming commitment_signed
476
477
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 ( ) ) ;
478
479
479
480
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
480
481
let ( payment_preimage, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -553,7 +554,7 @@ fn test_monitor_update_fail_no_rebroadcast() {
553
554
// test_restore_channel_monitor() is required. Backported from
554
555
// chanmon_fail_consistency fuzz tests.
555
556
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 ( ) ) ;
557
558
558
559
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
559
560
let ( payment_preimage_1, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -595,7 +596,7 @@ fn test_monitor_update_raa_while_paused() {
595
596
// Tests handling of an RAA while monitor updating has already been marked failed.
596
597
// Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
597
598
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 ( ) ) ;
599
600
600
601
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 5000000 , 5_000_000 ) ;
601
602
@@ -662,8 +663,8 @@ fn test_monitor_update_raa_while_paused() {
662
663
fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
663
664
// Tests handling of a monitor update failure when processing an incoming RAA
664
665
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 ( ) ) ;
667
668
668
669
// Rebalance a bit so that we can send backwards from 2 to 1.
669
670
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -915,8 +916,8 @@ fn test_monitor_update_fail_reestablish() {
915
916
// channel_reestablish generating a monitor update (which comes from freeing holding cell
916
917
// HTLCs).
917
918
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 ( ) ) ;
920
921
921
922
let ( our_payment_preimage, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1000000 ) ;
922
923
@@ -993,7 +994,7 @@ fn raa_no_response_awaiting_raa_state() {
993
994
// in question (assuming it intends to respond with a CS after monitor updating is restored).
994
995
// Backported from chanmon_fail_consistency fuzz tests as this used to be broken.
995
996
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 ( ) ) ;
997
998
998
999
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
999
1000
let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -1106,7 +1107,7 @@ fn claim_while_disconnected_monitor_update_fail() {
1106
1107
// code introduced a regression in this test (specifically, this caught a removal of the
1107
1108
// channel_reestablish handling ensuring the order was sensical given the messages used).
1108
1109
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 ( ) ) ;
1110
1111
1111
1112
// Forward a payment for B to claim
1112
1113
let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
@@ -1221,7 +1222,7 @@ fn monitor_failed_no_reestablish_response() {
1221
1222
// Backported from chanmon_fail_consistency fuzz tests as it caught a long-standing
1222
1223
// debug_assert!() failure in channel_reestablish handling.
1223
1224
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 ( ) ) ;
1225
1226
1226
1227
// Route the payment and deliver the initial commitment_signed (with a monitor update failure
1227
1228
// on receipt).
@@ -1287,7 +1288,7 @@ fn first_message_on_recv_ordering() {
1287
1288
// payment applied).
1288
1289
// Backported from chanmon_fail_consistency fuzz tests as it caught a bug here.
1289
1290
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 ( ) ) ;
1291
1292
1292
1293
// Route the first payment outbound, holding the last RAA for B until we are set up so that we
1293
1294
// can deliver it and fail the monitor update.
@@ -1372,8 +1373,8 @@ fn test_monitor_update_fail_claim() {
1372
1373
// payment from B to A fail due to the paused channel. Finally, we restore the channel monitor
1373
1374
// updating and claim the payment on B.
1374
1375
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 ( ) ) ;
1377
1378
1378
1379
// Rebalance a bit so that we can send backwards from 3 to 2.
1379
1380
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -1445,8 +1446,8 @@ fn test_monitor_update_on_pending_forwards() {
1445
1446
// The payment from A to C will be failed by C and pending a back-fail to A, while the payment
1446
1447
// from C to A will be pending a forward to A.
1447
1448
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 ( ) ) ;
1450
1451
1451
1452
// Rebalance a bit so that we can send backwards from 3 to 1.
1452
1453
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 , 5_000_000 ) ;
@@ -1510,7 +1511,7 @@ fn monitor_update_claim_fail_no_response() {
1510
1511
// Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
1511
1512
// code was broken.
1512
1513
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 ( ) ) ;
1514
1515
1515
1516
// Forward a payment for B to claim
1516
1517
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:
1571
1572
let mut nodes = create_network ( 2 , & [ None , None ] ) ;
1572
1573
1573
1574
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( ) ) ) ;
1576
1577
1577
1578
let ( temporary_channel_id, funding_tx, funding_output) = create_funding_transaction ( & nodes[ 0 ] , 100000 , 43 ) ;
1578
1579
0 commit comments