From 74fa567cda3b26cccce90f82d9733e8f577a347d Mon Sep 17 00:00:00 2001 From: Anthony Laibe Date: Fri, 9 Aug 2024 12:17:19 +0200 Subject: [PATCH] fix(wallet)_: return balance when available, do not fail all --- services/wallet/token/balancefetcher/balance_fetcher.go | 3 +-- .../wallet/token/balancefetcher/balance_fetcher_test.go | 8 -------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/services/wallet/token/balancefetcher/balance_fetcher.go b/services/wallet/token/balancefetcher/balance_fetcher.go index 3668d2dfc..4c7395793 100644 --- a/services/wallet/token/balancefetcher/balance_fetcher.go +++ b/services/wallet/token/balancefetcher/balance_fetcher.go @@ -300,7 +300,6 @@ func (bf *DefaultBalanceFetcher) GetBalancesAtByChain(parent context.Context, cl if err != nil { return err } - updateBalance(client.NetworkID(), balances) return nil }) @@ -310,5 +309,5 @@ func (bf *DefaultBalanceFetcher) GetBalancesAtByChain(parent context.Context, cl case <-parent.Done(): return nil, parent.Err() } - return response, group.Error() + return response, nil } diff --git a/services/wallet/token/balancefetcher/balance_fetcher_test.go b/services/wallet/token/balancefetcher/balance_fetcher_test.go index 375f3e4e7..f048cc578 100644 --- a/services/wallet/token/balancefetcher/balance_fetcher_test.go +++ b/services/wallet/token/balancefetcher/balance_fetcher_test.go @@ -382,12 +382,4 @@ func TestBalanceFetcherGetBalancesAtByChain(t *testing.T) { require.NoError(t, err) require.Equal(t, expectedBalances, balances) - - // Fetch native balances and token balances using scan contract for Arbitrum Mainnet - chainClientsArb := map[uint64]chain.ClientInterface{w_common.ArbitrumMainnet: chainClientArb} - balancesArb, errArb := bf.GetBalancesAtByChain(ctx, chainClientsArb, accounts, tokens, atBlocks) - - require.Error(t, errArb, "GetBalancesAtByChain should return an error for Arbitrum Mainnet") - require.Contains(t, errArb.Error(), "no scan contract", "Incorrect error message for Arbitrum Mainnet") - require.Nil(t, balancesArb[w_common.ArbitrumMainnet]) }