aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-02-13 21:03:16 +0800
committerGitHub <noreply@github.com>2017-02-13 21:03:16 +0800
commitf8f428cc18c5f70814d7b3937128781bac14bffd (patch)
treed93d285d2ec22bd8ed646695c3db116c69fa3329 /eth
parente23e86921b55cb1ee2fca6b6fb9ed91f5532f9fd (diff)
parente99c788155ddd754c73d2c81b6051dcbd42e6575 (diff)
downloadgo-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar
go-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.gz
go-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.bz2
go-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.lz
go-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.xz
go-tangerine-f8f428cc18c5f70814d7b3937128781bac14bffd.tar.zst
go-tangerine-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.go14
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