aboutsummaryrefslogtreecommitdiffstats
path: root/eth
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2017-12-10 06:42:23 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-12-10 06:42:23 +0800
commit46e5583993afe7b9d0ff432f846b2a97bcb89876 (patch)
treef768a04b9d0ba71fbb0251ffff761610b3ea7eb7 /eth
parentbf62acf0332c962916787a23c78a2513137625ea (diff)
downloaddexon-46e5583993afe7b9d0ff432f846b2a97bcb89876.tar.gz
dexon-46e5583993afe7b9d0ff432f846b2a97bcb89876.tar.zst
dexon-46e5583993afe7b9d0ff432f846b2a97bcb89876.zip
cmd/utils, eth: init etherbase from within eth (#15528)
Diffstat (limited to 'eth')
-rw-r--r--eth/backend.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/eth/backend.go b/eth/backend.go
index e7f0f57dd..c39974a2c 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -310,10 +310,17 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) {
}
if wallets := s.AccountManager().Wallets(); len(wallets) > 0 {
if accounts := wallets[0].Accounts(); len(accounts) > 0 {
- return accounts[0].Address, nil
+ etherbase := accounts[0].Address
+
+ s.lock.Lock()
+ s.etherbase = etherbase
+ s.lock.Unlock()
+
+ log.Info("Etherbase automatically configured", "address", etherbase)
+ return etherbase, nil
}
}
- return common.Address{}, fmt.Errorf("etherbase address must be explicitly specified")
+ return common.Address{}, fmt.Errorf("etherbase must be explicitly specified")
}
// set in js console via admin interface or wrapper from cli flags