good morning!!!!

Skip to content
Snippets Groups Projects
Commit 1356daad authored by Viktor Trón's avatar Viktor Trón
Browse files

etherbase defaults to first account even if created during the session

parent d18d2564
Branches
Tags
No related merge requests found
...@@ -159,7 +159,7 @@ func TestAccounts(t *testing.T) { ...@@ -159,7 +159,7 @@ func TestAccounts(t *testing.T) {
defer os.RemoveAll(tmp) defer os.RemoveAll(tmp)
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`"]`) 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")`) val, err := repl.re.Run(`personal.newAccount("password")`)
if err != nil { if err != nil {
t.Errorf("expected no error, got %v", err) t.Errorf("expected no error, got %v", err)
...@@ -170,6 +170,7 @@ func TestAccounts(t *testing.T) { ...@@ -170,6 +170,7 @@ func TestAccounts(t *testing.T) {
} }
checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`","`+addr+`"]`) checkEvalJSON(t, repl, `eth.accounts`, `["`+testAddress+`","`+addr+`"]`)
} }
func TestBlockChain(t *testing.T) { func TestBlockChain(t *testing.T) {
......
...@@ -489,8 +489,12 @@ func (s *Ethereum) StartMining(threads int) error { ...@@ -489,8 +489,12 @@ func (s *Ethereum) StartMining(threads int) error {
func (s *Ethereum) Etherbase() (eb common.Address, err error) { func (s *Ethereum) Etherbase() (eb common.Address, err error) {
eb = s.etherbase eb = s.etherbase
if (eb == common.Address{}) { if (eb == common.Address{}) {
addr, e := s.AccountManager().AddressByIndex(0)
if e != nil {
err = fmt.Errorf("etherbase address must be explicitly specified") err = fmt.Errorf("etherbase address must be explicitly specified")
} }
eb = common.HexToAddress(addr)
}
return return
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment