From 828c650bbcb09abccb7d777352416f2284be595b Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Sun, 30 Jul 2017 20:21:45 -0700 Subject: [PATCH] config: add new command line param --defaultchanconfs This commit adds a new command line option that allows clients to specify a default value to use when responding to a new channel funding request. In a future change, a pure mapping will be added, with the command line option having higher precedence. --- config.go | 20 ++++++++++++-------- lnd.go | 2 +- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/config.go b/config.go index f9ebf088f..032adc663 100644 --- a/config.go +++ b/config.go @@ -30,6 +30,7 @@ const ( defaultPeerPort = 5656 defaultRPCHost = "localhost" defaultMaxPendingChannels = 1 + defaultNumChanConfs = 1 ) var ( @@ -96,6 +97,8 @@ type config struct { Litecoin *chainConfig `group:"Litecoin" namespace:"litecoin"` Bitcoin *chainConfig `group:"Bitcoin" namespace:"bitcoin"` + DefaultNumChanConfs int `long:"defaultchanconfs" description:"The default number of confirmations a channel must have before it's considered open."` + NeutrinoMode *neutrinoConfig `group:"neutrino" namespace:"neutrino"` } @@ -109,14 +112,15 @@ type config struct { // 4) Parse CLI options and overwrite/add any specified options func loadConfig() (*config, error) { defaultCfg := config{ - ConfigFile: defaultConfigFile, - DataDir: defaultDataDir, - DebugLevel: defaultLogLevel, - LogDir: defaultLogDir, - PeerPort: defaultPeerPort, - RPCPort: defaultRPCPort, - RESTPort: defaultRESTPort, - MaxPendingChannels: defaultMaxPendingChannels, + ConfigFile: defaultConfigFile, + DataDir: defaultDataDir, + DebugLevel: defaultLogLevel, + LogDir: defaultLogDir, + PeerPort: defaultPeerPort, + RPCPort: defaultRPCPort, + RESTPort: defaultRESTPort, + MaxPendingChannels: defaultMaxPendingChannels, + DefaultNumChanConfs: defaultNumChanConfs, Bitcoin: &chainConfig{ RPCHost: defaultRPCHost, RPCCert: defaultBtcdRPCCertFile, diff --git a/lnd.go b/lnd.go index 585a2af5d..fc63c6ab2 100644 --- a/lnd.go +++ b/lnd.go @@ -162,7 +162,7 @@ func lndMain() error { // TODO(roasbeef): add configurable mapping // * simple switch initially // * assign coefficient, etc - return 1 + return uint16(cfg.DefaultNumChanConfs) }, RequiredRemoteDelay: func(chanAmt btcutil.Amount) uint16 { // TODO(roasbeef): add additional hooks for