node/governor: handle type assertion error
This commit is contained in:
parent
478ea22a3f
commit
a5092db982
|
@ -156,8 +156,12 @@ func (gov *ChainGovernor) queryCoinGecko() error {
|
||||||
if exists {
|
if exists {
|
||||||
// If a price is not set in CoinGecko, they return an empty entry. Treat that as a zero price.
|
// If a price is not set in CoinGecko, they return an empty entry. Treat that as a zero price.
|
||||||
var price float64
|
var price float64
|
||||||
|
m, ok := data.(map[string]interface{})
|
||||||
m := data.(map[string]interface{})
|
if !ok {
|
||||||
|
gov.logger.Error("failed to parse CoinGecko response, reverting to configured price for this token", zap.String("coinGeckoId", coinGeckoId))
|
||||||
|
// By continuing, we leave this one in the local map so the price will get reverted below.
|
||||||
|
continue
|
||||||
|
}
|
||||||
if len(m) != 0 {
|
if len(m) != 0 {
|
||||||
var ok bool
|
var ok bool
|
||||||
price_, ok := m["usd"]
|
price_, ok := m["usd"]
|
||||||
|
|
Loading…
Reference in New Issue