accounts: streamline API

- Manager.Accounts no longer returns an error.
- Manager methods take Account instead of common.Address.
- All uses of Account with unkeyed fields are converted.
This commit is contained in:
Felix Lange
2016-03-03 01:09:16 +01:00
parent 2dc20963e7
commit 46e8940b19
11 changed files with 79 additions and 144 deletions

View File

@ -359,13 +359,13 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) {
func (s *Ethereum) Etherbase() (eb common.Address, err error) {
eb = s.etherbase
if (eb == common.Address{}) {
addr, e := s.AccountManager().AddressByIndex(0)
if e != nil {
err = fmt.Errorf("etherbase address must be explicitly specified")
firstAccount, err := s.AccountManager().AccountByIndex(0)
eb = firstAccount.Address
if err != nil {
return eb, fmt.Errorf("etherbase address must be explicitly specified")
}
eb = common.HexToAddress(addr)
}
return
return eb, nil
}
// set in js console via admin interface or wrapper from cli flags