@@ -15,7 +15,7 @@ use chain::channelmonitor::{ChannelMonitor, CLTV_CLAIM_BUFFER, LATENCY_GRACE_PER
15
15
use chain:: keysinterface:: { KeysInterface , Recipient } ;
16
16
use ln:: { PaymentHash , PaymentSecret } ;
17
17
use ln:: channel:: EXPIRE_PREV_CONFIG_TICKS ;
18
- use ln:: channelmanager:: { ChannelManager , ChannelManagerReadArgs , HTLCForwardInfo , CLTV_FAR_FAR_AWAY , MIN_CLTV_EXPIRY_DELTA , PendingHTLCInfo , PendingHTLCRouting } ;
18
+ use ln:: channelmanager:: { self , ChannelManager , ChannelManagerReadArgs , HTLCForwardInfo , CLTV_FAR_FAR_AWAY , MIN_CLTV_EXPIRY_DELTA , PendingHTLCInfo , PendingHTLCRouting } ;
19
19
use ln:: onion_utils;
20
20
use routing:: gossip:: { NetworkUpdate , RoutingFees , NodeId } ;
21
21
use routing:: router:: { get_route, PaymentParameters , Route , RouteHint , RouteHintHop } ;
@@ -270,7 +270,7 @@ fn test_fee_failures() {
270
270
let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
271
271
let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ Some ( config) , Some ( config) , Some ( config) ] ) ;
272
272
let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
273
- let channels = [ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) , create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ] ;
273
+ let channels = [ create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) , create_announced_chan_between_nodes ( & nodes, 1 , 2 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ] ;
274
274
275
275
// positive case
276
276
let ( route, payment_hash_success, payment_preimage_success, payment_secret_success) = get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , 40_000 ) ;
@@ -322,7 +322,7 @@ fn test_onion_failure() {
322
322
let node_cfgs = create_node_cfgs ( 3 , & chanmon_cfgs) ;
323
323
let node_chanmgrs = create_node_chanmgrs ( 3 , & node_cfgs, & [ Some ( config) , Some ( config) , Some ( node_2_cfg) ] ) ;
324
324
let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
325
- let channels = [ create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) , create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ] ;
325
+ let channels = [ create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) , create_announced_chan_between_nodes ( & nodes, 1 , 2 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ] ;
326
326
for node in nodes. iter ( ) {
327
327
* node. keys_manager . override_random_bytes . lock ( ) . unwrap ( ) = Some ( [ 3 ; 32 ] ) ;
328
328
}
@@ -607,16 +607,16 @@ fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
607
607
let mut nodes = create_network ( 3 , & node_cfgs, & node_chanmgrs) ;
608
608
609
609
let other_channel = create_chan_between_nodes (
610
- & nodes[ 0 ] , & nodes[ 1 ] , InitFeatures :: known ( ) , InitFeatures :: known ( ) ,
610
+ & nodes[ 0 ] , & nodes[ 1 ] , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ,
611
611
) ;
612
612
let channel_to_update = if announced_channel {
613
613
let channel = create_announced_chan_between_nodes (
614
- & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ,
614
+ & nodes, 1 , 2 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ,
615
615
) ;
616
616
( channel. 2 , channel. 0 . contents . short_channel_id )
617
617
} else {
618
618
let channel = create_unannounced_chan_between_nodes_with_value (
619
- & nodes, 1 , 2 , 100000 , 10001 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ,
619
+ & nodes, 1 , 2 , 100000 , 10001 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ,
620
620
) ;
621
621
( channel. 0 . channel_id , channel. 0 . short_channel_id_alias . unwrap ( ) )
622
622
} ;
@@ -641,7 +641,7 @@ fn do_test_onion_failure_stale_channel_update(announced_channel: bool) {
641
641
htlc_minimum_msat: None ,
642
642
} ] ) ] ;
643
643
let payment_params = PaymentParameters :: from_node_id ( * channel_to_update_counterparty)
644
- . with_features ( InvoiceFeatures :: known ( ) )
644
+ . with_features ( channelmanager :: provided_invoice_features ( ) )
645
645
. with_route_hints ( hop_hints) ;
646
646
get_route_and_payment_hash ! ( nodes[ 0 ] , nodes[ 2 ] , payment_params, PAYMENT_AMT , TEST_FINAL_CLTV )
647
647
} ;
@@ -802,10 +802,10 @@ fn test_default_to_onion_payload_tlv_format() {
802
802
let node_chanmgrs = create_node_chanmgrs ( 5 , & node_cfgs, & [ None , None , None , None , Some ( priv_channels_conf) ] ) ;
803
803
let mut nodes = create_network ( 5 , & node_cfgs, & node_chanmgrs) ;
804
804
805
- create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
806
- create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
807
- create_announced_chan_between_nodes ( & nodes, 2 , 3 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
808
- create_unannounced_chan_between_nodes_with_value ( & nodes, 3 , 4 , 100000 , 10001 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
805
+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
806
+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
807
+ create_announced_chan_between_nodes ( & nodes, 2 , 3 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
808
+ create_unannounced_chan_between_nodes_with_value ( & nodes, 3 , 4 , 100000 , 10001 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
809
809
810
810
let payment_params = PaymentParameters :: from_node_id ( nodes[ 3 ] . node . get_our_node_id ( ) ) ;
811
811
let origin_node = & nodes[ 0 ] ;
@@ -830,7 +830,7 @@ fn test_default_to_onion_payload_tlv_format() {
830
830
// supports variable length onions, as the `InitFeatures` exchanged in the init message
831
831
// between the nodes will be used when creating the route. We therefore do not default to
832
832
// supporting variable length onions for that hop, as the `InitFeatures` in this case are
833
- // `InitFeatures::known ()`.
833
+ // `channelmanager::provided_init_features ()`.
834
834
835
835
let unannounced_chan = & nodes[ 4 ] . node . list_usable_channels ( ) [ 0 ] ;
836
836
@@ -897,9 +897,9 @@ fn test_do_not_default_to_onion_payload_tlv_format_when_unsupported() {
897
897
let node_chanmgrs = create_node_chanmgrs ( 4 , & node_cfgs, & [ None , None , None , None ] ) ;
898
898
let mut nodes = create_network ( 4 , & node_cfgs, & node_chanmgrs) ;
899
899
900
- create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
901
- create_announced_chan_between_nodes ( & nodes, 1 , 2 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
902
- create_announced_chan_between_nodes ( & nodes, 2 , 3 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
900
+ create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
901
+ create_announced_chan_between_nodes ( & nodes, 1 , 2 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
902
+ create_announced_chan_between_nodes ( & nodes, 2 , 3 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
903
903
904
904
let payment_params = PaymentParameters :: from_node_id ( nodes[ 3 ] . node . get_our_node_id ( ) )
905
905
. with_features ( InvoiceFeatures :: empty ( ) ) ;
@@ -961,7 +961,7 @@ macro_rules! get_phantom_route {
961
961
let phantom_pubkey = PublicKey :: from_secret_key( & secp_ctx, & phantom_secret) ;
962
962
let phantom_route_hint = $nodes[ 1 ] . node. get_phantom_route_hints( ) ;
963
963
let payment_params = PaymentParameters :: from_node_id( phantom_pubkey)
964
- . with_features( InvoiceFeatures :: known ( ) )
964
+ . with_features( channelmanager :: provided_invoice_features ( ) )
965
965
. with_route_hints( vec![ RouteHint ( vec![
966
966
RouteHintHop {
967
967
src_node_id: $nodes[ 0 ] . node. get_our_node_id( ) ,
@@ -1003,7 +1003,7 @@ fn test_phantom_onion_hmac_failure() {
1003
1003
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1004
1004
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1005
1005
1006
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1006
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1007
1007
1008
1008
// Get the route.
1009
1009
let recv_value_msat = 10_000 ;
@@ -1062,7 +1062,7 @@ fn test_phantom_invalid_onion_payload() {
1062
1062
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1063
1063
let mut nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1064
1064
1065
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1065
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1066
1066
1067
1067
// Get the route.
1068
1068
let recv_value_msat = 10_000 ;
@@ -1135,7 +1135,7 @@ fn test_phantom_final_incorrect_cltv_expiry() {
1135
1135
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1136
1136
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1137
1137
1138
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1138
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1139
1139
1140
1140
// Get the route.
1141
1141
let recv_value_msat = 10_000 ;
@@ -1191,7 +1191,7 @@ fn test_phantom_failure_too_low_cltv() {
1191
1191
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1192
1192
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1193
1193
1194
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1194
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1195
1195
1196
1196
// Get the route.
1197
1197
let recv_value_msat = 10_000 ;
@@ -1236,7 +1236,7 @@ fn test_phantom_failure_too_low_recv_amt() {
1236
1236
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1237
1237
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1238
1238
1239
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1239
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1240
1240
1241
1241
// Get the route with a too-low amount.
1242
1242
let recv_amt_msat = 10_000 ;
@@ -1290,7 +1290,7 @@ fn test_phantom_dust_exposure_failure() {
1290
1290
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , Some ( receiver_config) ] ) ;
1291
1291
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1292
1292
1293
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1293
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1294
1294
1295
1295
// Get the route with an amount exceeding the dust exposure threshold of nodes[1].
1296
1296
let ( _, payment_hash, payment_secret) = get_payment_preimage_hash ! ( nodes[ 1 ] , Some ( max_dust_exposure + 1 ) ) ;
@@ -1332,7 +1332,7 @@ fn test_phantom_failure_reject_payment() {
1332
1332
let node_chanmgrs = create_node_chanmgrs ( 2 , & node_cfgs, & [ None , None ] ) ;
1333
1333
let nodes = create_network ( 2 , & node_cfgs, & node_chanmgrs) ;
1334
1334
1335
- let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , InitFeatures :: known ( ) , InitFeatures :: known ( ) ) ;
1335
+ let channel = create_announced_chan_between_nodes ( & nodes, 0 , 1 , channelmanager :: provided_init_features ( ) , channelmanager :: provided_init_features ( ) ) ;
1336
1336
1337
1337
// Get the route with a too-low amount.
1338
1338
let recv_amt_msat = 10_000 ;
0 commit comments