fetch.js fix

This morning the Vidulum chain was showing all validators as red and missed blocks.

There might be a more inline way to do the logic but it wasn't comparing both to be greater than 1.  After making sure both were compared against, the update for Vidulum was resolved.

I also spot checked a few other chains to ensure their uptimes were showing properly and they were.
This commit is contained in:
Erialos 2022-10-10 06:58:45 -06:00
parent e15789e095
commit d0ab40da1b

View File

@ -62,7 +62,7 @@ export default class ChainFetch {
async getLatestBlock(config = null) { async getLatestBlock(config = null) {
const conf = config || this.getSelectedConfig() const conf = config || this.getSelectedConfig()
const ver = conf.sdk_version || '0.41' const ver = conf.sdk_version || '0.41'
if (ver && compareVersions(ver, '0.45') < 1) { if (ver < 1 && compareVersions(ver, '0.45') < 1) {
return this.get('/blocks/latest', config).then(data => Block.create(data)) return this.get('/blocks/latest', config).then(data => Block.create(data))
} }
return this.get('/cosmos/base/tendermint/v1beta1/blocks/latest', config).then(data => Block.create(data)) return this.get('/cosmos/base/tendermint/v1beta1/blocks/latest', config).then(data => Block.create(data))
@ -71,7 +71,7 @@ export default class ChainFetch {
async getBlockByHeight(height, config = null) { async getBlockByHeight(height, config = null) {
const conf = config || this.getSelectedConfig() const conf = config || this.getSelectedConfig()
const ver = conf.sdk_version || '0.41' const ver = conf.sdk_version || '0.41'
if (ver && compareVersions(ver, '0.45') < 1) { if (ver < 1 && compareVersions(ver, '0.45') < 1) {
return this.get(`/blocks/${height}`, config).then(data => Block.create(data)) return this.get(`/blocks/${height}`, config).then(data => Block.create(data))
} }
return this.get(`/cosmos/base/tendermint/v1beta1/blocks/${height}`, config).then(data => Block.create(data)) return this.get(`/cosmos/base/tendermint/v1beta1/blocks/${height}`, config).then(data => Block.create(data))