remove coin filtering for now

This commit is contained in:
Patrick O'Grady 2020-11-13 11:19:50 -08:00
parent dfec6d4b1a
commit dca1a597ed
No known key found for this signature in database
GPG key ID: 8DE11C985C0C8D85

View file

@ -49,6 +49,8 @@ func (s *AccountAPIService) AccountBalance(
return nil, wrapErr(ErrUnavailableOffline, nil) return nil, wrapErr(ErrUnavailableOffline, nil)
} }
// TODO: filter balances by request currencies
// If we are fetching the current balance, // If we are fetching the current balance,
// return all coins for an address and calculate // return all coins for an address and calculate
// the balance from those coins. // the balance from those coins.
@ -106,6 +108,12 @@ func (s *AccountAPIService) AccountCoins(
return nil, wrapErr(ErrUnavailableOffline, nil) 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) coins, block, err := s.i.GetCoins(ctx, request.AccountIdentifier)
if err != nil { if err != nil {
return nil, wrapErr(ErrUnableToGetCoins, err) return nil, wrapErr(ErrUnableToGetCoins, err)
@ -116,22 +124,5 @@ func (s *AccountAPIService) AccountCoins(
Coins: coins, 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 return result, nil
} }