// 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);
use util::ser::{Readable, ReadableArgs, Writeable, Writer, VecWriter};
use util::logger::Logger;
use util::errors::APIError;
-use util::config::{UserConfig,ChannelConfig};
+use util::config::{UserConfig,ChannelConfig,ChannelHandshakeConfig};
use util::scid_utils::scid_from_parts;
use io;
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 user_id = Readable::read(reader)?;
let mut config = Some(ChannelConfig::default());
+ let mut handshake_config = Some(ChannelHandshakeConfig::default());
if ver == 1 {
// Read the old serialization of the ChannelConfig from version 0.0.98.
config.as_mut().unwrap().forwarding_fee_proportional_millionths = Readable::read(reader)?;
// Read the 8 bytes of backwards-compatibility ChannelConfig data.
let mut _val: u64 = Readable::read(reader)?;
}
+
+ handshake_config.as_mut().unwrap().commit_upfront_shutdown_pubkey = Readable::read(reader)?;
let channel_id = Readable::read(reader)?;
let channel_state = Readable::read(reader)?;
let mut config = UserConfig::default();
config.channel_options.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.channel_options.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.channel_options.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.channel_options.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.channel_options.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);
/// Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
/// by the protocol.
pub our_htlc_minimum_msat: u64,
+ /// 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.
+ ///
+ /// This cannot be changed after a channel has been initialized.
+ ///
+ /// Default value: true.
+ pub commit_upfront_shutdown_pubkey: bool
}
impl Default for ChannelHandshakeConfig {
minimum_depth: 6,
our_to_self_delay: BREAKDOWN_TIMEOUT,
our_htlc_minimum_msat: 1,
+ commit_upfront_shutdown_pubkey: true
}
}
}
///
/// 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.
- ///
- /// This cannot be changed after a channel has been initialized.
- ///
- /// Default value: true.
- pub commit_upfront_shutdown_pubkey: bool,
+ /// This value is moved to ChannelHandshakeConfig, optional here for old serialiization
+ pub commit_upfront_shutdown_pubkey: Option<bool>,
/// Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
/// small to claim on-chain.
///
forwarding_fee_base_msat: 1000,
cltv_expiry_delta: 6 * 12, // 6 blocks/hour * 12 hours
announced_channel: false,
- commit_upfront_shutdown_pubkey: true,
+ commit_upfront_shutdown_pubkey: Some(true),
max_dust_htlc_exposure_msat: 5_000_000,
force_close_avoidance_max_fee_satoshis: 1000,
}
(2, cltv_expiry_delta, required),
(3, force_close_avoidance_max_fee_satoshis, (default_value, 1000)),
(4, announced_channel, required),
- (6, commit_upfront_shutdown_pubkey, required),
+ (6, commit_upfront_shutdown_pubkey, option),
(8, forwarding_fee_base_msat, required),
});