From 77abf0830f5b780bb5399fc900068569a74e660c Mon Sep 17 00:00:00 2001 From: Otto Suess Date: Thu, 27 Dec 2018 12:06:17 +0100 Subject: [PATCH] fix: display same error as lnd when multiple networks are selected --- config.go | 12 ++++++++++++ lndconnect.go | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index cb92a35..900672d 100644 --- a/config.go +++ b/config.go @@ -154,18 +154,30 @@ func loadConfig() (*config, error) { primaryChain = "litecoin" networkName = "mainnet" case cfg.Bitcoin.Active: + numNets := 0 if cfg.Bitcoin.MainNet { + numNets++ networkName = "mainnet" } if cfg.Bitcoin.TestNet3 { + numNets++ networkName = "testnet" } if cfg.Bitcoin.RegTest { + numNets++ networkName = "regtest" } if cfg.Bitcoin.SimNet { + numNets++ networkName = "simnet" } + if numNets > 1 { + str := "The mainnet, testnet, regtest, and " + + "simnet params can't be used together -- " + + "choose one of the four" + err := fmt.Errorf(str) + return nil, err + } primaryChain = "bitcoin" } diff --git a/lndconnect.go b/lndconnect.go index b6d98ec..f53842f 100644 --- a/lndconnect.go +++ b/lndconnect.go @@ -48,7 +48,7 @@ func getPublicIP() string { func main() { loadedConfig, err := loadConfig() if err != nil { - fmt.Println() + fmt.Println(err) return }