cmd/utils, eth: init etherbase from within eth (#15528)

This commit is contained in:
Péter Szilágyi
2017-12-10 00:42:23 +02:00
committed by Felix Lange
parent bf62acf033
commit 46e5583993
2 changed files with 15 additions and 11 deletions

View File

@ -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