diff options
author | Péter Szilágyi <peterke@gmail.com> | 2017-02-13 21:03:16 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-13 21:03:16 +0800 |
commit | f8f428cc18c5f70814d7b3937128781bac14bffd (patch) | |
tree | d93d285d2ec22bd8ed646695c3db116c69fa3329 /eth | |
parent | e23e86921b55cb1ee2fca6b6fb9ed91f5532f9fd (diff) | |
parent | e99c788155ddd754c73d2c81b6051dcbd42e6575 (diff) | |
download | dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.gz dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.bz2 dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.lz dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.xz dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.zst dexon-f8f428cc18c5f70814d7b3937128781bac14bffd.zip |
Merge pull request #3592 from karalabe/hw-wallets
accounts: initial support for Ledger hardware wallets
Diffstat (limited to 'eth')
-rw-r--r-- | eth/backend.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/eth/backend.go b/eth/backend.go index af120cbad..ef3ac93c8 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -361,15 +361,15 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) { } func (s *Ethereum) Etherbase() (eb common.Address, err error) { - eb = s.etherbase - if (eb == common.Address{}) { - firstAccount, err := s.AccountManager().AccountByIndex(0) - eb = firstAccount.Address - if err != nil { - return eb, fmt.Errorf("etherbase address must be explicitly specified") + if s.etherbase != (common.Address{}) { + return s.etherbase, nil + } + if wallets := s.AccountManager().Wallets(); len(wallets) > 0 { + if accounts := wallets[0].Accounts(); len(accounts) > 0 { + return accounts[0].Address, nil } } - return eb, nil + return common.Address{}, fmt.Errorf("etherbase address must be explicitly specified") } // set in js console via admin interface or wrapper from cli flags |