aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-01-24 17:49:20 +0800
committerPéter Szilágyi <peterke@gmail.com>2017-02-13 20:00:02 +0800
commit833e4d1319336fbb66fd8f1e473c24472d65b17b (patch)
tree74d45d86d0c59c19f0ff67831f04e0cad9776eef /eth
parent564b60520c68a1f06171abd705c01946b932492f (diff)
downloaddexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar.gz
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar.bz2
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar.lz
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar.xz
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.tar.zst
dexon-833e4d1319336fbb66fd8f1e473c24472d65b17b.zip
accounts, cmd, eth, internal, mobile, node: split account backends
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/eth/backend.go b/eth/backend.go
index af120cbad..004be7e26 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -361,15 +361,13 @@ 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 accounts := s.AccountManager().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