Fetch balances when db cache doesn't exist (#4710)

This commit is contained in:
Roman Volosovskyi 2024-02-12 10:10:28 +01:00 committed by GitHub
parent 3ea2002904
commit 76d58ba7f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -1 +1 @@
0.174.3 0.174.4

View File

@ -274,7 +274,13 @@ func (r *Reader) FetchOrGetCachedWalletBalances(ctx context.Context, addresses [
return balances, nil return balances, nil
} }
return r.persistence.GetTokens() tokens, err := r.persistence.GetTokens()
// there should be at least ETH balance
if len(tokens) == 0 {
return r.GetWalletTokenBalances(ctx, addresses)
}
return tokens, err
} }
func (r *Reader) GetWalletTokenBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error) { func (r *Reader) GetWalletTokenBalances(ctx context.Context, addresses []common.Address) (map[common.Address][]Token, error) {