Merge pull request #1533 from ethersphere/frontier/etherbase

Etherbase defaults to first account even if it is created during the session
This commit is contained in:
Jeffrey Wilcke
2015-07-28 05:11:43 -07:00
2 changed files with 7 additions and 2 deletions

View File

@ -489,7 +489,11 @@ func (s *Ethereum) StartMining(threads int) error {
func (s *Ethereum) Etherbase() (eb common.Address, err error) {
eb = s.etherbase
if (eb == common.Address{}) {
err = fmt.Errorf("etherbase address must be explicitly specified")
addr, e := s.AccountManager().AddressByIndex(0)
if e != nil {
err = fmt.Errorf("etherbase address must be explicitly specified")
}
eb = common.HexToAddress(addr)
}
return
}