// Test that temporary failures when updating the monitor's shutdown script delay cooperative
// close.
let mut config = test_default_channel_config();
- config.channel_options.commit_upfront_shutdown_pubkey = false;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
// Test that permanent failures when updating the monitor's shutdown script result in a force
// close when initiating a cooperative close.
let mut config = test_default_channel_config();
- config.channel_options.commit_upfront_shutdown_pubkey = false;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
// Test that permanent failures when updating the monitor's shutdown script result in a force
// close when handling a cooperative close.
let mut config = test_default_channel_config();
- config.channel_options.commit_upfront_shutdown_pubkey = false;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let chanmon_cfgs = create_chanmon_cfgs(2);
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs);
let mut secp_ctx = Secp256k1::new();
secp_ctx.seeded_randomize(&keys_provider.get_secure_random_bytes());
- let shutdown_scriptpubkey = if config.channel_options.commit_upfront_shutdown_pubkey {
+ let shutdown_scriptpubkey = if config.own_channel_config.commit_upfront_shutdown_pubkey {
Some(keys_provider.get_shutdown_scriptpubkey())
} else { None };
}
} else { None };
- let shutdown_scriptpubkey = if config.channel_options.commit_upfront_shutdown_pubkey {
+ let shutdown_scriptpubkey = if config.own_channel_config.commit_upfront_shutdown_pubkey {
Some(keys_provider.get_shutdown_scriptpubkey())
} else { None };
let mut config = UserConfig::default();
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;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let mut config = UserConfig::default();
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;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let mut config = UserConfig::default();
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;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let mut config = UserConfig::default();
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;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let mut node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
let mut config = UserConfig::default();
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;
+ config.own_channel_config.commit_upfront_shutdown_pubkey = false;
let user_cfgs = [None, Some(config), None];
let chanmon_cfgs = create_chanmon_cfgs(3);
let node_cfgs = create_node_cfgs(3, &chanmon_cfgs);
///
/// If this option is set, channels may be created that will not be readable by LDK versions
/// prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
- /// [`DecodeError:InvalidValue`].
+ /// [`DecodeError::InvalidValue`].
///
/// Note that setting this to true does *not* prevent us from opening channels with
/// counterparties that do not support the `scid_alias` option; we will simply fall back to a
/// 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
+ /// [`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.
///
/// Default value: false.
pub announced_channel: bool,
+ /// When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
+ /// supports it, they will then enforce the mutual-close output to us matches what we provided
+ /// at intialization, preventing us from closing to an alternate pubkey.
+ ///
+ /// This is set to true by default to provide a slight increase in security, though ultimately
+ /// any attacker who is able to take control of a channel can just as easily send the funds via
+ /// lightning payments, so we never require that our counterparties support this option.
+ ///
+ /// The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`].
+ ///
+ /// Default value: true.
+ ///
+ /// [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
+ pub commit_upfront_shutdown_pubkey: bool,
}
impl Default for ChannelHandshakeConfig {
max_inbound_htlc_value_in_flight_percent_of_channel: 10,
negotiate_scid_privacy: false,
announced_channel: false,
+ commit_upfront_shutdown_pubkey: true,
}
}
}