Skip to content

Commit d2d3166

Browse files
authored
accounts/external: fill account-cache if that hasn't already been done, fixes #20995 (#20998)
1 parent 2337aa6 commit d2d3166

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

‎accounts/external/backend.go‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ func (api *ExternalSigner) Accounts() []accounts.Account {
131131
func (api *ExternalSigner) Contains(account accounts.Account) bool {
132132
api.cacheMu.RLock()
133133
defer api.cacheMu.RUnlock()
134+
if api.cache == nil {
135+
// If we haven't already fetched the accounts, it's time to do so now
136+
api.cacheMu.RUnlock()
137+
api.Accounts()
138+
api.cacheMu.RLock()
139+
}
134140
for _, a := range api.cache {
135141
if a.Address == account.Address && (account.URL == (accounts.URL{}) || account.URL == api.URL()) {
136142
return true

0 commit comments

Comments
 (0)