mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
ethapi: bubble up listaccounts error, remove extapi ref from private acct api
This commit is contained in:
parent
9e3f27fc18
commit
b1da7dfece
2 changed files with 11 additions and 15 deletions
|
|
@ -191,21 +191,17 @@ func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI {
|
||||||
p := &PrivateAccountAPI{
|
p := &PrivateAccountAPI{
|
||||||
nonceLock: nonceLock,
|
nonceLock: nonceLock,
|
||||||
b: b,
|
b: b,
|
||||||
extapi: b.ExternalSigner(),
|
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListAccounts will return a list of addresses for accounts this node manages.
|
// ListAccounts will return a list of addresses for accounts this node manages.
|
||||||
func (s *PrivateAccountAPI) ListAccounts() []common.Address {
|
func (s *PrivateAccountAPI) ListAccounts() ([]common.Address, error) {
|
||||||
addresses := make([]common.Address, 0) // return [] instead of nil if empty
|
if extapi := s.b.ExternalSigner(); extapi != nil {
|
||||||
if s.extapi != nil {
|
return extapi.ListAccounts()
|
||||||
if accounts, err := s.extapi.ListAccounts(); err == nil {
|
|
||||||
return accounts
|
|
||||||
}
|
}
|
||||||
return addresses
|
// return [] instead of nil if empty
|
||||||
}
|
return []common.Address{}, errors.New("external signer not configured")
|
||||||
return addresses
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// rawWallet is a JSON representation of an accounts.Wallet interface, with its
|
// rawWallet is a JSON representation of an accounts.Wallet interface, with its
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue