let mut config = UserConfig::default();
config.channel_options.forwarding_fee_proportional_millionths = 0;
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
let network = Network::Bitcoin;
let params = ChainParameters {
network,
let mut config = UserConfig::default();
config.channel_options.forwarding_fee_proportional_millionths = 0;
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
let mut monitors = HashMap::new();
let mut old_monitors = $old_monitors.latest_monitors.lock().unwrap();
let keys_manager = Arc::new(KeyProvider { node_secret: our_network_key.clone(), inbound_payment_key: KeyMaterial(inbound_payment_key.try_into().unwrap()), counter: AtomicU64::new(0) });
let mut config = UserConfig::default();
config.channel_options.forwarding_fee_proportional_millionths = slice_to_be32(get_slice!(4));
- config.channel_options.announced_channel = get_slice!(1)[0] != 0;
+ config.own_channel_config.announced_channel = get_slice!(1)[0] != 0;
let network = Network::Bitcoin;
let params = ChainParameters {
network,
// `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
// is never handled, the `channel.counterparty.forwarding_info` is never assigned.
let mut private_chan_cfg = UserConfig::default();
- private_chan_cfg.channel_options.announced_channel = false;
+ private_chan_cfg.own_channel_config.announced_channel = false;
let temporary_channel_id = nodes[2].node.create_channel(nodes[0].node.get_our_node_id(), 1_000_000, 500_000_000, 42, Some(private_chan_cfg)).unwrap();
let open_channel = get_event_msg!(nodes[2], MessageSendEvent::SendOpenChannel, nodes[0].node.get_our_node_id());
nodes[0].node.handle_open_channel(&nodes[2].node.get_our_node_id(), InitFeatures::known(), &open_channel);
// `msgs::ChannelUpdate` is never handled for the node(s). As the `msgs::ChannelUpdate`
// is never handled, the `channel.counterparty.forwarding_info` is never assigned.
let mut private_chan_cfg = UserConfig::default();
- private_chan_cfg.channel_options.announced_channel = false;
+ private_chan_cfg.own_channel_config.announced_channel = false;
let temporary_channel_id = nodes[1].node.create_channel(nodes[3].node.get_our_node_id(), 1_000_000, 500_000_000, 42, Some(private_chan_cfg)).unwrap();
let open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[3].node.get_our_node_id());
nodes[3].node.handle_open_channel(&nodes[1].node.get_our_node_id(), InitFeatures::known(), &open_channel);
// available. If it's private, we first try `scid_privacy` as it provides better privacy
// with no other changes, and fall back to `only_static_remotekey`
let mut ret = ChannelTypeFeatures::only_static_remote_key();
- if !config.channel_options.announced_channel && config.own_channel_config.negotiate_scid_privacy {
+ if !config.own_channel_config.announced_channel && config.own_channel_config.negotiate_scid_privacy {
ret.set_scid_privacy_required();
}
ret
// Convert things into internal flags and prep our state:
if config.peer_channel_config_limits.force_announced_channel_preference {
- if local_config.announced_channel != announced_channel {
+ if config.own_channel_config.announced_channel != announced_channel {
return Err(ChannelError::Close("Peer tried to open channel but their announcement preference is different from ours".to_owned()));
}
}
let counterparty_node_id = PublicKey::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32]).unwrap());
let mut config = UserConfig::default();
- config.channel_options.announced_channel = false;
+ config.own_channel_config.announced_channel = false;
let mut chan = Channel::<InMemorySigner>::new_outbound(&&feeest, &&keys_provider, counterparty_node_id, &InitFeatures::known(), 10_000_000, 100000, 42, &config, 0, 42).unwrap(); // Nothing uses their network key in this test
chan.holder_dust_limit_satoshis = 546;
chan.counterparty_selected_channel_reserve_satoshis = Some(0); // Filled in in accept_channel
pub fn create_unannounced_chan_between_nodes_with_value<'a, 'b, 'c, 'd>(nodes: &'a Vec<Node<'b, 'c, 'd>>, a: usize, b: usize, channel_value: u64, push_msat: u64, a_flags: InitFeatures, b_flags: InitFeatures) -> (msgs::ChannelReady, Transaction) {
let mut no_announce_cfg = test_default_channel_config();
- no_announce_cfg.channel_options.announced_channel = false;
+ no_announce_cfg.own_channel_config.announced_channel = false;
nodes[a].node.create_channel(nodes[b].node.get_our_node_id(), channel_value, push_msat, 42, Some(no_announce_cfg)).unwrap();
let open_channel = get_event_msg!(nodes[a], MessageSendEvent::SendOpenChannel, nodes[b].node.get_our_node_id());
nodes[b].node.handle_open_channel(&nodes[a].node.get_our_node_id(), a_flags, &open_channel);
// Set cltv_expiry_delta slightly lower to keep the final CLTV values inside one byte in our
// tests so that our script-length checks don't fail (see ACCEPTED_HTLC_SCRIPT_WEIGHT).
default_config.channel_options.cltv_expiry_delta = MIN_CLTV_EXPIRY_DELTA;
- default_config.channel_options.announced_channel = true;
+ default_config.own_channel_config.announced_channel = true;
default_config.peer_channel_config_limits.force_announced_channel_preference = false;
// When most of our tests were written, the default HTLC minimum was fixed at 1000.
// It now defaults to 1, so we simply set it to the expected value here.
fn test_justice_tx() {
// Test justice txn built on revoked HTLC-Success tx, against both sides
let mut alice_config = UserConfig::default();
- alice_config.channel_options.announced_channel = true;
+ alice_config.own_channel_config.announced_channel = true;
alice_config.peer_channel_config_limits.force_announced_channel_preference = false;
alice_config.own_channel_config.our_to_self_delay = 6 * 24 * 5;
let mut bob_config = UserConfig::default();
- bob_config.channel_options.announced_channel = true;
+ bob_config.own_channel_config.announced_channel = true;
bob_config.peer_channel_config_limits.force_announced_channel_preference = false;
bob_config.own_channel_config.our_to_self_delay = 6 * 24 * 3;
let user_cfgs = [Some(alice_config), Some(bob_config)];
// 2. MUST be set to less than or equal to the `max_htlc_value_in_flight_msat` received from the peer.
let mut config_30_percent = UserConfig::default();
- config_30_percent.channel_options.announced_channel = true;
+ config_30_percent.own_channel_config.announced_channel = true;
config_30_percent.own_channel_config.max_inbound_htlc_value_in_flight_percent_of_channel = 30;
let mut config_50_percent = UserConfig::default();
- config_50_percent.channel_options.announced_channel = true;
+ config_50_percent.own_channel_config.announced_channel = true;
config_50_percent.own_channel_config.max_inbound_htlc_value_in_flight_percent_of_channel = 50;
let mut config_95_percent = UserConfig::default();
- config_95_percent.channel_options.announced_channel = true;
+ config_95_percent.own_channel_config.announced_channel = true;
config_95_percent.own_channel_config.max_inbound_htlc_value_in_flight_percent_of_channel = 95;
let mut config_100_percent = UserConfig::default();
- config_100_percent.channel_options.announced_channel = true;
+ config_100_percent.own_channel_config.announced_channel = true;
config_100_percent.own_channel_config.max_inbound_htlc_value_in_flight_percent_of_channel = 100;
let chanmon_cfgs = create_chanmon_cfgs(4);
// Channel::get_counterparty_htlc_minimum_msat().
let mut node_2_cfg: UserConfig = Default::default();
node_2_cfg.own_channel_config.our_htlc_minimum_msat = 2000;
- node_2_cfg.channel_options.announced_channel = true;
+ node_2_cfg.own_channel_config.announced_channel = true;
node_2_cfg.peer_channel_config_limits.force_announced_channel_preference = false;
// When this test was written, the default base fee floated based on the HTLC count.
// `features` for a node in the `network_graph` exists, or when the node isn't in the
// `network_graph`, and no other known `features` for the node exists.
let mut priv_channels_conf = UserConfig::default();
- priv_channels_conf.channel_options.announced_channel = false;
+ priv_channels_conf.own_channel_config.announced_channel = false;
let chanmon_cfgs = create_chanmon_cfgs(5);
let node_cfgs = create_node_cfgs(5, &chanmon_cfgs);
let node_chanmgrs = create_node_chanmgrs(5, &node_cfgs, &[None, None, None, None, Some(priv_channels_conf)]);
let max_dust_exposure = 546;
let mut receiver_config = UserConfig::default();
receiver_config.channel_options.max_dust_htlc_exposure_msat = max_dust_exposure;
- receiver_config.channel_options.announced_channel = true;
+ receiver_config.own_channel_config.announced_channel = true;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
// tests that we properly send one in that case.
let mut alice_config = UserConfig::default();
alice_config.own_channel_config.minimum_depth = 1;
- alice_config.channel_options.announced_channel = true;
+ alice_config.own_channel_config.announced_channel = true;
alice_config.peer_channel_config_limits.force_announced_channel_preference = false;
let mut bob_config = UserConfig::default();
bob_config.own_channel_config.minimum_depth = 1;
- bob_config.channel_options.announced_channel = true;
+ bob_config.own_channel_config.announced_channel = true;
bob_config.peer_channel_config_limits.force_announced_channel_preference = false;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let mut scid_privacy_cfg = test_default_channel_config();
- scid_privacy_cfg.channel_options.announced_channel = true;
+ scid_privacy_cfg.own_channel_config.announced_channel = true;
scid_privacy_cfg.own_channel_config.negotiate_scid_privacy = true;
nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(scid_privacy_cfg)).unwrap();
let mut open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
let mut nodes = create_network(2, &node_cfgs, &node_chanmgrs);
let mut scid_privacy_cfg = test_default_channel_config();
- scid_privacy_cfg.channel_options.announced_channel = false;
+ scid_privacy_cfg.own_channel_config.announced_channel = false;
scid_privacy_cfg.own_channel_config.negotiate_scid_privacy = true;
nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(scid_privacy_cfg)).unwrap();
create_announced_chan_between_nodes_with_value(&nodes, 0, 1, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
let mut no_announce_cfg = test_default_channel_config();
- no_announce_cfg.channel_options.announced_channel = false;
+ no_announce_cfg.own_channel_config.announced_channel = false;
no_announce_cfg.own_channel_config.negotiate_scid_privacy = true;
nodes[1].node.create_channel(nodes[2].node.get_our_node_id(), 100_000, 10_000, 42, Some(no_announce_cfg)).unwrap();
let mut open_channel = get_event_msg!(nodes[1], MessageSendEvent::SendOpenChannel, nodes[2].node.get_our_node_id());
create_announced_chan_between_nodes_with_value(&nodes, 1, 2, 1_000_000, 0, InitFeatures::known(), InitFeatures::known());
- chan_config.channel_options.announced_channel = false;
+ chan_config.own_channel_config.announced_channel = false;
nodes[0].node.create_channel(nodes[1].node.get_our_node_id(), 100000, 10001, 42, Some(chan_config)).unwrap();
let open_channel = get_event_msg!(nodes[0], MessageSendEvent::SendOpenChannel, nodes[1].node.get_our_node_id());
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// This is the default but we force it on anyway
- chan_config.channel_options.announced_channel = true;
+ chan_config.own_channel_config.announced_channel = true;
open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
// We can use the channel immediately, but won't generate a channel_update until we get confs
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// This is the default but we force it on anyway
- chan_config.channel_options.announced_channel = true;
+ chan_config.own_channel_config.announced_channel = true;
let tx = open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
// We can use the channel immediately, but we can't announce it until we get 6+ confirmations
let nodes = create_network(2, &node_cfgs, &node_chanmgrs);
// This is the default but we force it on anyway
- chan_config.channel_options.announced_channel = true;
+ chan_config.own_channel_config.announced_channel = true;
let tx = open_zero_conf_channel(&nodes[0], &nodes[1], Some(chan_config));
// We can use the channel immediately, but we can't announce it until we get 6+ confirmations
// enforce it at shutdown message
let mut config = UserConfig::default();
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
#[test]
fn test_segwit_v0_shutdown_script() {
let mut config = UserConfig::default();
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
#[test]
fn test_anysegwit_shutdown_script() {
let mut config = UserConfig::default();
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
#[test]
fn test_unsupported_anysegwit_shutdown_script() {
let mut config = UserConfig::default();
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
#[test]
fn test_invalid_shutdown_script() {
let mut config = UserConfig::default();
- config.channel_options.announced_channel = true;
+ config.own_channel_config.announced_channel = true;
config.peer_channel_config_limits.force_announced_channel_preference = false;
config.channel_options.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
/// private channel without that option.
///
/// Ignored if the channel is negotiated to be announced, see
- /// [`ChannelConfig::announced_channel`] and
+ /// [`ChannelHandshakeConfig::announced_channel`] and
/// [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
///
/// Default value: false. This value is likely to change to true in the future.
/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
/// [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
pub negotiate_scid_privacy: bool,
+ /// Set to announce the channel publicly and notify all nodes that they can route via this
+ /// channel.
+ ///
+ /// This should only be set to true for nodes which expect to be online reliably.
+ ///
+ /// As the node which funds a channel picks this value this will only apply for new outbound
+ /// channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
+ ///
+ /// Default value: false.
+ pub announced_channel: bool,
}
impl Default for ChannelHandshakeConfig {
our_htlc_minimum_msat: 1,
max_inbound_htlc_value_in_flight_percent_of_channel: 10,
negotiate_scid_privacy: false,
+ announced_channel: false,
}
}
}
/// Default value: true
pub trust_own_funding_0conf: bool,
/// Set to force an incoming channel to match our announced channel preference in
- /// [`ChannelConfig::announced_channel`].
+ /// [`ChannelHandshakeConfig::announced_channel`].
///
/// For a node which is not online reliably, this should be set to true and
- /// [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+ /// [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public)
/// channels will ever be opened.
///
/// Default value: true.
/// node which is not online reliably.
///
/// For nodes which are not online reliably, you should set all channels to *not* be announced
- /// (using [`ChannelConfig::announced_channel`] and
+ /// (using [`ChannelHandshakeConfig::announced_channel`] and
/// [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
/// ensure you are not exposed to any forwarding risk.
///