6
6
use ln:: channelmanager:: { RAACommitmentOrder , PaymentPreimage , PaymentHash } ;
7
7
use ln:: channelmonitor:: ChannelMonitorUpdateErr ;
8
8
use ln:: msgs;
9
- use ln:: msgs:: ChannelMessageHandler ;
9
+ use ln:: msgs:: { ChannelMessageHandler , LocalFeatures } ;
10
10
use util:: events:: { Event , EventsProvider , MessageSendEvent , MessageSendEventsProvider } ;
11
11
use util:: errors:: APIError ;
12
12
@@ -18,8 +18,8 @@ use ln::functional_test_utils::*;
18
18
#[ test]
19
19
fn test_simple_monitor_permanent_update_fail ( ) {
20
20
// 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 ( ) ) ;
23
23
24
24
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
25
25
let ( _, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -48,8 +48,8 @@ fn test_simple_monitor_permanent_update_fail() {
48
48
fn do_test_simple_monitor_temporary_update_fail ( disconnect : bool ) {
49
49
// Test that we can recover from a simple temporary monitor update failure optionally with
50
50
// 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 ( ) ) ;
53
53
54
54
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
55
55
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) {
147
147
// * We then walk through more message exchanges to get the original update_add_htlc
148
148
// through, swapping message ordering based on disconnect_count & 8 and optionally
149
149
// 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 ( ) ) ;
152
152
153
153
let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
154
154
@@ -473,8 +473,8 @@ fn test_monitor_temporary_update_fail_c() {
473
473
#[ test]
474
474
fn test_monitor_update_fail_cs ( ) {
475
475
// 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 ( ) ) ;
478
478
479
479
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
480
480
let ( payment_preimage, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -552,8 +552,8 @@ fn test_monitor_update_fail_no_rebroadcast() {
552
552
// Tests handling of a monitor update failure when no message rebroadcasting on
553
553
// test_restore_channel_monitor() is required. Backported from
554
554
// 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 ( ) ) ;
557
557
558
558
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
559
559
let ( payment_preimage_1, our_payment_hash) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -594,8 +594,8 @@ fn test_monitor_update_fail_no_rebroadcast() {
594
594
fn test_monitor_update_raa_while_paused ( ) {
595
595
// Tests handling of an RAA while monitor updating has already been marked failed.
596
596
// 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 ( ) ) ;
599
599
600
600
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 5000000 ) ;
601
601
@@ -661,9 +661,9 @@ fn test_monitor_update_raa_while_paused() {
661
661
662
662
fn do_test_monitor_update_fail_raa ( test_ignore_second_cs : bool ) {
663
663
// 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 ( ) ) ;
667
667
668
668
// Rebalance a bit so that we can send backwards from 2 to 1.
669
669
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -914,9 +914,9 @@ fn test_monitor_update_fail_reestablish() {
914
914
// Simple test for message retransmission after monitor update failure on
915
915
// channel_reestablish generating a monitor update (which comes from freeing holding cell
916
916
// 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 ( ) ) ;
920
920
921
921
let ( our_payment_preimage, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 1000000 ) ;
922
922
@@ -992,8 +992,8 @@ fn raa_no_response_awaiting_raa_state() {
992
992
// due to a previous monitor update failure, we still set AwaitingRemoteRevoke on the channel
993
993
// in question (assuming it intends to respond with a CS after monitor updating is restored).
994
994
// 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 ( ) ) ;
997
997
998
998
let route = nodes[ 0 ] . router . get_route ( & nodes[ 1 ] . node . get_our_node_id ( ) , None , & Vec :: new ( ) , 1000000 , TEST_FINAL_CLTV ) . unwrap ( ) ;
999
999
let ( payment_preimage_1, payment_hash_1) = get_payment_preimage_hash ! ( nodes[ 0 ] ) ;
@@ -1105,8 +1105,8 @@ fn claim_while_disconnected_monitor_update_fail() {
1105
1105
// Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
1106
1106
// code introduced a regression in this test (specifically, this caught a removal of the
1107
1107
// 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 ( ) ) ;
1110
1110
1111
1111
// Forward a payment for B to claim
1112
1112
let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
@@ -1220,8 +1220,8 @@ fn monitor_failed_no_reestablish_response() {
1220
1220
// response to a commitment_signed.
1221
1221
// Backported from chanmon_fail_consistency fuzz tests as it caught a long-standing
1222
1222
// 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 ( ) ) ;
1225
1225
1226
1226
// Route the payment and deliver the initial commitment_signed (with a monitor update failure
1227
1227
// on receipt).
@@ -1286,8 +1286,8 @@ fn first_message_on_recv_ordering() {
1286
1286
// have no pending response but will want to send a RAA/CS (with the updates for the second
1287
1287
// payment applied).
1288
1288
// 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 ( ) ) ;
1291
1291
1292
1292
// Route the first payment outbound, holding the last RAA for B until we are set up so that we
1293
1293
// can deliver it and fail the monitor update.
@@ -1371,9 +1371,9 @@ fn test_monitor_update_fail_claim() {
1371
1371
// update to claim the payment. We then send a payment C->B->A, making the forward of this
1372
1372
// payment from B to A fail due to the paused channel. Finally, we restore the channel monitor
1373
1373
// 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 ( ) ) ;
1377
1377
1378
1378
// Rebalance a bit so that we can send backwards from 3 to 2.
1379
1379
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -1441,9 +1441,9 @@ fn test_monitor_update_on_pending_forwards() {
1441
1441
// We do this with a simple 3-node network, sending a payment from A to C and one from C to A.
1442
1442
// The payment from A to C will be failed by C and pending a back-fail to A, while the payment
1443
1443
// 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 ( ) ) ;
1447
1447
1448
1448
// Rebalance a bit so that we can send backwards from 3 to 1.
1449
1449
send_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] , & nodes[ 2 ] ] , 5000000 ) ;
@@ -1505,8 +1505,8 @@ fn monitor_update_claim_fail_no_response() {
1505
1505
// to channel being AwaitingRAA).
1506
1506
// Backported from chanmon_fail_consistency fuzz tests as an unmerged version of the handling
1507
1507
// 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 ( ) ) ;
1510
1510
1511
1511
// Forward a payment for B to claim
1512
1512
let ( payment_preimage_1, _) = route_payment ( & nodes[ 0 ] , & [ & nodes[ 1 ] ] , 1000000 ) ;
0 commit comments