X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning%2Fsrc%2Futil%2Fconfig.rs;h=f43423d7c0c0af923a4ac8f08a562aea474f946c;hb=21a44da960e9439aac2d58f9802e5382d9f60564;hp=c76747cbbf8e1de83ab1ac381ae09c8c266de5d3;hpb=9e03d2bc7a5d45c56722b40348b143403167142c;p=rust-lightning diff --git a/lightning/src/util/config.rs b/lightning/src/util/config.rs index c76747cb..f43423d7 100644 --- a/lightning/src/util/config.rs +++ b/lightning/src/util/config.rs @@ -1,36 +1,21 @@ +// This file is Copyright its original authors, visible in version control +// history. +// +// This file is licensed under the Apache License, Version 2.0 or the MIT license +// , at your option. +// You may not use this file except in accordance with one or both of these +// licenses. + //! Various user-configurable channel limits and settings which ChannelManager //! applies for you. use ln::channelmanager::{BREAKDOWN_TIMEOUT, MAX_LOCAL_BREAKDOWN_TIMEOUT}; -/// Top-level config which holds ChannelHandshakeLimits and ChannelConfig. -/// -/// Default::default() provides sane defaults for most configurations -/// (but currently with 0 relay fees!) -#[derive(Clone, Debug)] -pub struct UserConfig { - /// Channel config that we propose to our counterparty. - pub own_channel_config: ChannelHandshakeConfig, - /// Limits applied to our counterparty's proposed channel config settings. - pub peer_channel_config_limits: ChannelHandshakeLimits, - /// Channel config which affects behavior during channel lifetime. - pub channel_options: ChannelConfig, -} - -impl Default for UserConfig { - fn default() -> Self { - UserConfig { - own_channel_config: ChannelHandshakeConfig::default(), - peer_channel_config_limits: ChannelHandshakeLimits::default(), - channel_options: ChannelConfig::default(), - } - } -} - /// Configuration we set when applicable. /// /// Default::default() provides sane defaults. -#[derive(Clone, Debug)] +#[derive(Copy, Clone, Debug)] pub struct ChannelHandshakeConfig { /// Confirmations we will wait for before considering the channel locked in. /// Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the @@ -219,3 +204,27 @@ impl_writeable!(ChannelConfig, 8+1+1, { announced_channel, commit_upfront_shutdown_pubkey }); + +/// Top-level config which holds ChannelHandshakeLimits and ChannelConfig. +/// +/// Default::default() provides sane defaults for most configurations +/// (but currently with 0 relay fees!) +#[derive(Copy, Clone, Debug)] +pub struct UserConfig { + /// Channel config that we propose to our counterparty. + pub own_channel_config: ChannelHandshakeConfig, + /// Limits applied to our counterparty's proposed channel config settings. + pub peer_channel_config_limits: ChannelHandshakeLimits, + /// Channel config which affects behavior during channel lifetime. + pub channel_options: ChannelConfig, +} + +impl Default for UserConfig { + fn default() -> Self { + UserConfig { + own_channel_config: ChannelHandshakeConfig::default(), + peer_channel_config_limits: ChannelHandshakeLimits::default(), + channel_options: ChannelConfig::default(), + } + } +}