From dca1a597ed0f2004d76eabb23298aee59db27922 Mon Sep 17 00:00:00 2001 From: Patrick O'Grady Date: Fri, 13 Nov 2020 11:19:50 -0800 Subject: [PATCH] remove coin filtering for now --- services/account_service.go | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/services/account_service.go b/services/account_service.go index 8c8adff..5edcfa4 100644 --- a/services/account_service.go +++ b/services/account_service.go @@ -49,6 +49,8 @@ func (s *AccountAPIService) AccountBalance( return nil, wrapErr(ErrUnavailableOffline, nil) } + // TODO: filter balances by request currencies + // If we are fetching the current balance, // return all coins for an address and calculate // the balance from those coins. @@ -106,6 +108,12 @@ func (s *AccountAPIService) AccountCoins( return nil, wrapErr(ErrUnavailableOffline, nil) } + // TODO: filter coins by request currencies + + // TODO: support include_mempool query + // https://github.com/coinbase/rosetta-bitcoin/issues/36#issuecomment-724992022 + // Once mempoolcoins are supported also change the bool service/types.go:MempoolCoins to true + coins, block, err := s.i.GetCoins(ctx, request.AccountIdentifier) if err != nil { return nil, wrapErr(ErrUnableToGetCoins, err) @@ -116,22 +124,5 @@ func (s *AccountAPIService) AccountCoins( Coins: coins, } - //@Todo include_mempool query unsupported - //https://github.com/coinbase/rosetta-bitcoin/issues/36#issuecomment-724992022 - //Once mempoolcoins are supported also change the bool service/types.go:MempoolCoins to true - - if len(request.Currencies) > 0 { - filtered := []*types.Coin{} - - for _, curr := range request.Currencies { - for _, coin := range coins { - if types.Hash(curr) == types.Hash(coin.Amount.Currency) { - filtered = append(filtered, coin) - } - } - } - result.Coins = filtered - } - return result, nil }