fix: get balance with multiple chain (#2689)

This commit is contained in:
Anthony Laibe 2022-05-26 12:44:29 +02:00 committed by GitHub
parent 78cba969cc
commit 97a99d6254
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -263,12 +263,13 @@ func (tm *TokenManager) getBalances(parent context.Context, clients []*chain.Cli
mu sync.Mutex mu sync.Mutex
response = map[common.Address]map[common.Address]*hexutil.Big{} response = map[common.Address]map[common.Address]*hexutil.Big{}
) )
for _, client := range clients { for clientIdx := range clients {
for tokenIdx := range tokens { for tokenIdx := range tokens {
for accountIdx := range accounts { for accountIdx := range accounts {
// Below, we set account and token from idx on purpose to avoid override // Below, we set account, token and client from idx on purpose to avoid override
account := accounts[accountIdx] account := accounts[accountIdx]
token := tokens[tokenIdx] token := tokens[tokenIdx]
client := clients[clientIdx]
group.Add(func(parent context.Context) error { group.Add(func(parent context.Context) error {
ctx, cancel := context.WithTimeout(parent, requestTimeout) ctx, cancel := context.WithTimeout(parent, requestTimeout)
defer cancel() defer cancel()