From fe5863d95d7c171d86e33562bca2f9705dc64c60 Mon Sep 17 00:00:00 2001 From: daniel1302 Date: Thu, 17 Nov 2022 18:15:10 +0100 Subject: [PATCH] feat: fix panic for coinmarketcap --- pricing/coinmarketcap.go | 1 + service/service.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pricing/coinmarketcap.go b/pricing/coinmarketcap.go index b2b4470..8e957fb 100644 --- a/pricing/coinmarketcap.go +++ b/pricing/coinmarketcap.go @@ -63,6 +63,7 @@ func coinmarketcapStartFetching( "URL": sourcecfg.URL.String(), "rateLimitDuration": oneRequestEvery, }).Errorln("failed to get trading data.") + continue } for _, price := range board.PriceList(sourcecfg.Name) { diff --git a/service/service.go b/service/service.go index 6c01839..c77aeb9 100644 --- a/service/service.go +++ b/service/service.go @@ -6,6 +6,7 @@ import ( "fmt" "net/http" "strconv" + "strings" "time" "code.vegaprotocol.io/priceproxy/config" @@ -163,8 +164,8 @@ func (s *Service) PricesGet(w http.ResponseWriter, r *http.Request, ps httproute for k, v := range s.pe.GetPrices() { if (source == "" || source == k.Source) && - (base == "" || base == k.Base) && - (quote == "" || quote == k.Quote) && + (base == "" || strings.EqualFold(base, k.Base) || strings.EqualFold(base, k.BaseOverride)) && + (quote == "" || strings.EqualFold(quote, k.Quote) || strings.EqualFold(quote, k.QuoteOverride)) && (wanderPtr == nil || *wanderPtr == k.Wander) { returnedQuote := k.Quote if k.QuoteOverride != "" {