mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
accounts/external: fill account-cache if that hasn't already been done, fixes #20995
This commit is contained in:
parent
7f95a85fd4
commit
2174e8d3de
1 changed files with 6 additions and 0 deletions
6
accounts/external/backend.go
vendored
6
accounts/external/backend.go
vendored
|
|
@ -131,6 +131,12 @@ func (api *ExternalSigner) Accounts() []accounts.Account {
|
|||
func (api *ExternalSigner) Contains(account accounts.Account) bool {
|
||||
api.cacheMu.RLock()
|
||||
defer api.cacheMu.RUnlock()
|
||||
if api.cache == nil {
|
||||
// If we haven't already fetched the accounts, it's time to do so now
|
||||
api.cacheMu.RUnlock()
|
||||
api.Accounts()
|
||||
api.cacheMu.RLock()
|
||||
}
|
||||
for _, a := range api.cache {
|
||||
if a.Address == account.Address && (account.URL == (accounts.URL{}) || account.URL == api.URL()) {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Reference in a new issue