From b6acefd38516572d72fa1db7049aeb2f6a2449cf Mon Sep 17 00:00:00 2001 From: Oliver Gugger Date: Mon, 10 Feb 2020 11:25:32 +0100 Subject: [PATCH] Fix chain parameters for all commands --- cmd/chantools/dumpchannels.go | 2 ++ cmd/chantools/forceclose.go | 2 ++ cmd/chantools/genimportscript.go | 2 ++ cmd/chantools/rescueclosed.go | 2 ++ cmd/chantools/showrootkey.go | 2 ++ cmd/chantools/summary.go | 2 ++ cmd/chantools/sweeptimelock.go | 2 ++ cmd/chantools/walletinfo.go | 5 ++++- 8 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cmd/chantools/dumpchannels.go b/cmd/chantools/dumpchannels.go index 72e6f13..5468c99 100644 --- a/cmd/chantools/dumpchannels.go +++ b/cmd/chantools/dumpchannels.go @@ -17,6 +17,8 @@ type dumpChannelsCommand struct { } func (c *dumpChannelsCommand) Execute(_ []string) error { + setupChainParams(cfg) + // Check that we have a channel DB. if c.ChannelDB == "" { return fmt.Errorf("channel DB is required") diff --git a/cmd/chantools/forceclose.go b/cmd/chantools/forceclose.go index 1b62c3f..8ed3272 100644 --- a/cmd/chantools/forceclose.go +++ b/cmd/chantools/forceclose.go @@ -25,6 +25,8 @@ type forceCloseCommand struct { } func (c *forceCloseCommand) Execute(_ []string) error { + setupChainParams(cfg) + var ( extendedKey *hdkeychain.ExtendedKey err error diff --git a/cmd/chantools/genimportscript.go b/cmd/chantools/genimportscript.go index bac993f..0f3f104 100644 --- a/cmd/chantools/genimportscript.go +++ b/cmd/chantools/genimportscript.go @@ -23,6 +23,8 @@ type genImportScriptCommand struct { } func (c *genImportScriptCommand) Execute(_ []string) error { + setupChainParams(cfg) + var ( extendedKey *hdkeychain.ExtendedKey err error diff --git a/cmd/chantools/rescueclosed.go b/cmd/chantools/rescueclosed.go index d66010f..54ecaa7 100644 --- a/cmd/chantools/rescueclosed.go +++ b/cmd/chantools/rescueclosed.go @@ -37,6 +37,8 @@ type rescueClosedCommand struct { } func (c *rescueClosedCommand) Execute(_ []string) error { + setupChainParams(cfg) + var ( extendedKey *hdkeychain.ExtendedKey err error diff --git a/cmd/chantools/showrootkey.go b/cmd/chantools/showrootkey.go index 4339e10..02960aa 100644 --- a/cmd/chantools/showrootkey.go +++ b/cmd/chantools/showrootkey.go @@ -7,6 +7,8 @@ import ( type showRootKeyCommand struct{} func (c *showRootKeyCommand) Execute(_ []string) error { + setupChainParams(cfg) + rootKey, _, err := rootKeyFromConsole() if err != nil { return fmt.Errorf("failed to read root key from console: %v", diff --git a/cmd/chantools/summary.go b/cmd/chantools/summary.go index 55c4a51..2adf0ee 100644 --- a/cmd/chantools/summary.go +++ b/cmd/chantools/summary.go @@ -13,6 +13,8 @@ import ( type summaryCommand struct{} func (c *summaryCommand) Execute(_ []string) error { + setupChainParams(cfg) + // Parse channel entries from any of the possible input files. entries, err := parseInputType(cfg) if err != nil { diff --git a/cmd/chantools/sweeptimelock.go b/cmd/chantools/sweeptimelock.go index 158d0da..517e22c 100644 --- a/cmd/chantools/sweeptimelock.go +++ b/cmd/chantools/sweeptimelock.go @@ -27,6 +27,8 @@ type sweepTimeLockCommand struct { } func (c *sweepTimeLockCommand) Execute(_ []string) error { + setupChainParams(cfg) + var ( extendedKey *hdkeychain.ExtendedKey err error diff --git a/cmd/chantools/walletinfo.go b/cmd/chantools/walletinfo.go index 2b3394c..681404c 100644 --- a/cmd/chantools/walletinfo.go +++ b/cmd/chantools/walletinfo.go @@ -45,6 +45,8 @@ type walletInfoCommand struct { } func (c *walletInfoCommand) Execute(_ []string) error { + setupChainParams(cfg) + var ( publicWalletPw = lnwallet.DefaultPublicPassphrase privateWalletPw = lnwallet.DefaultPrivatePassphrase @@ -109,7 +111,8 @@ func walletInfo(w *wallet.Wallet) error { }, }) if err != nil { - return err + return fmt.Errorf("unable to open key ring for coin type %d: " + + "%v", chainParams.HDCoinType, err) } idPrivKey.Curve = btcec.S256() fmt.Printf(