diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-08-01 23:45:17 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-08-09 16:30:17 +0800 |
commit | db568a61e2a98880ab308bf2224aa34073dc7f39 (patch) | |
tree | 97da46661ad3002b6ff9f6dca07e3105da5a9c5a /cmd | |
parent | 17ce0a37de5a2712a8bf9d58df705e718b3b2cd6 (diff) | |
download | dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.gz dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.bz2 dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.lz dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.xz dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.tar.zst dexon-db568a61e2a98880ab308bf2224aa34073dc7f39.zip |
accounts, console, internal: support trezor hardware wallet
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/geth/main.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/cmd/geth/main.go b/cmd/geth/main.go index 58e949806..257cb2231 100644 --- a/cmd/geth/main.go +++ b/cmd/geth/main.go @@ -237,24 +237,28 @@ 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: + log.Info("New wallet appeared", "url", event.Wallet.URL(), "status", event.Wallet.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() } |