mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 03:10:48 +00:00
Update manager.go
This commit is contained in:
parent
cb97c48cb6
commit
da7a976b03
1 changed files with 9 additions and 2 deletions
|
|
@ -205,9 +205,16 @@ func (am *Manager) Accounts() []common.Address {
|
|||
am.lock.RLock()
|
||||
defer am.lock.RUnlock()
|
||||
|
||||
addresses := make([]common.Address, 0) // return [] instead of nil if empty
|
||||
walletAccounts := make([][]Account, 0, len(am.wallets))
|
||||
total := 0
|
||||
for _, wallet := range am.wallets {
|
||||
for _, account := range wallet.Accounts() {
|
||||
accounts := wallet.Accounts()
|
||||
total += len(accounts)
|
||||
walletAccounts = append(walletAccounts, accounts)
|
||||
}
|
||||
addresses := make([]common.Address, 0, total) // return [] instead of nil if empty
|
||||
for _, accounts := range walletAccounts {
|
||||
for _, account := range accounts {
|
||||
addresses = append(addresses, account.Address)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue