From 46e5583993afe7b9d0ff432f846b2a97bcb89876 Mon Sep 17 00:00:00 2001 From: Péter Szilágyi Date: Sun, 10 Dec 2017 00:42:23 +0200 Subject: cmd/utils, eth: init etherbase from within eth (#15528) --- eth/backend.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'eth') 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 -- cgit