etherbase defaults to first account even if created during the session

This commit is contained in:
zelig
2015-07-27 10:50:29 +02:00
parent d18d256442
commit 1356daad27
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
}