diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-08-14 23:52:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-14 23:52:40 +0800 |
commit | ef0edc6e32d98d2fca54076f38cb317f43704900 (patch) | |
tree | 3c110e3aa936721d90537074ea187cbfb5f5991c /cmd/geth/main.go | |
parent | 6ca59d98f88d4b4cc8bdeb2f023ff8c1fa228c6f (diff) | |
parent | 02656f9f614374b3f30b0cc57562e31c570cdf3d (diff) | |
download | dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.gz dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.bz2 dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.lz dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.xz dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.tar.zst dexon-ef0edc6e32d98d2fca54076f38cb317f43704900.zip |
Merge pull request #14885 from karalabe/trezor-boom
accounts, console, internal: support trezor hardware wallet
Diffstat (limited to 'cmd/geth/main.go')
-rw-r--r-- | cmd/geth/main.go | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 66958e34d..8166c9ce8 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -239,24 +239,30 @@ func startNode(ctx *cli.Context, stack *node.Node) { } stateReader := ethclient.NewClient(rpcClient) - // Open and self derive any wallets already attached + // Open any wallets already attached for _, wallet := range stack.AccountManager().Wallets() { if err := wallet.Open(""); err != nil { log.Warn("Failed to open wallet", "url", wallet.URL(), "err", err) - } else { - wallet.SelfDerive(accounts.DefaultBaseDerivationPath, stateReader) } } // Listen for wallet event till termination for event := range events { - if event.Arrive { + switch event.Kind { + case accounts.WalletArrived: if err := event.Wallet.Open(""); err != nil { log.Warn("New wallet appeared, failed to open", "url", event.Wallet.URL(), "err", err) + } + case accounts.WalletOpened: + status, _ := event.Wallet.Status() + log.Info("New wallet appeared", "url", event.Wallet.URL(), "status", status) + + if event.Wallet.URL().Scheme == "ledger" { + event.Wallet.SelfDerive(accounts.DefaultLedgerBaseDerivationPath, stateReader) } else { - log.Info("New wallet appeared", "url", event.Wallet.URL(), "status", event.Wallet.Status()) event.Wallet.SelfDerive(accounts.DefaultBaseDerivationPath, stateReader) } - } else { + + case accounts.WalletDropped: log.Info("Old wallet dropped", "url", event.Wallet.URL()) event.Wallet.Close() } |