From 833e4d1319336fbb66fd8f1e473c24472d65b17b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 24 Jan 2017 11:49:20 +0200 Subject: accounts, cmd, eth, internal, mobile, node: split account backends --- eth/backend.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'eth') diff --git a/eth/backend.go b/eth/backend.go index af120cbad..004be7e26 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -361,15 +361,13 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) { } func (s *Ethereum) Etherbase() (eb common.Address, err error) { - eb = s.etherbase - if (eb == common.Address{}) { - firstAccount, err := s.AccountManager().AccountByIndex(0) - eb = firstAccount.Address - if err != nil { - return eb, fmt.Errorf("etherbase address must be explicitly specified") - } + if s.etherbase != (common.Address{}) { + return s.etherbase, nil + } + if accounts := s.AccountManager().Accounts(); len(accounts) > 0 { + return accounts[0].Address, nil } - return eb, nil + return common.Address{}, fmt.Errorf("etherbase address must be explicitly specified") } // set in js console via admin interface or wrapper from cli flags -- cgit v1.2.3 From fad5eb0a87abfc12812647344a26de8a43830182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 7 Feb 2017 12:47:34 +0200 Subject: accounts, cmd, eth, internal, miner, node: wallets and HD APIs --- eth/backend.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'eth') diff --git a/eth/backend.go b/eth/backend.go index 004be7e26..ef3ac93c8 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -364,8 +364,10 @@ func (s *Ethereum) Etherbase() (eb common.Address, err error) { if s.etherbase != (common.Address{}) { return s.etherbase, nil } - if accounts := s.AccountManager().Accounts(); len(accounts) > 0 { - return accounts[0].Address, nil + if wallets := s.AccountManager().Wallets(); len(wallets) > 0 { + if accounts := wallets[0].Accounts(); len(accounts) > 0 { + return accounts[0].Address, nil + } } return common.Address{}, fmt.Errorf("etherbase address must be explicitly specified") } -- cgit v1.2.3