From d2d3166f35b7cdaa63c54503bfccd4c808564f18 Mon Sep 17 00:00:00 2001 From: Martin Holst Swende Date: Thu, 30 Apr 2020 18:57:06 +0200 Subject: [PATCH] accounts/external: fill account-cache if that hasn't already been done, fixes #20995 (#20998) --- accounts/external/backend.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/accounts/external/backend.go b/accounts/external/backend.go index 6089ca984..175458e80 100644 --- a/accounts/external/backend.go +++ b/accounts/external/backend.go @@ -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