mirror of https://github.com/status-im/op-geth.git
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:
commit
a281df783d
|
@ -159,7 +159,7 @@ func TestAccounts(t *testing.T) {
|
|||
defer os.RemoveAll(tmp)
|
||||
|
||||
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`)
|
||||
checkEvalJSON(t, repl, `eth.coinbase`, `null`)
|
||||
checkEvalJSON(t, repl, `eth.coinbase`, `"`+testAddress+`"`)
|
||||
val, err := repl.re.Run(`personal.newAccount("password")`)
|
||||
if err != nil {
|
||||
t.Errorf("expected no error, got %v", err)
|
||||
|
@ -170,6 +170,7 @@ func TestAccounts(t *testing.T) {
|
|||
}
|
||||
|
||||
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`","`+addr+`"]`)
|
||||
|
||||
}
|
||||
|
||||
func TestBlockChain(t *testing.T) {
|
||||
|
|
|
@ -489,8 +489,12 @@ func (s *Ethereum) StartMining(threads int) error {
|
|||
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")
|
||||
}
|
||||
eb = common.HexToAddress(addr)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue