aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/eth/backend.go b/eth/backend.go
index 7960a0e61..65b096d49 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -386,14 +386,17 @@ func (s *Ethereum) StartMining(threads int) error {
func (s *Ethereum) Etherbase() (eb common.Address, err error) {
eb = s.etherbase
if (eb == common.Address{}) {
- var ebbytes []byte
- ebbytes, err = s.accountManager.Primary()
- eb = common.BytesToAddress(ebbytes)
- if (eb == common.Address{}) {
+ primary, err := s.accountManager.Primary()
+ if err != nil {
+ return eb, err
+ }
+ if (primary == common.Address{}) {
err = fmt.Errorf("no accounts found")
+ return eb, err
}
+ eb = primary
}
- return
+ return eb, nil
}
func (s *Ethereum) StopMining() { s.miner.Stop() }