Skip to content

Commit

Permalink
Merge branch 'variable-comparison-blocks' into release-v0.5.16
Browse files Browse the repository at this point in the history
  • Loading branch information
tombeynon committed Feb 14, 2024
2 parents e2ad5fd + 6ec0fd2 commit 68e6ac2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion chains/chainMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ function ChainMonitor() {
const currentBlock = await got.get(`${restUrl}cosmos/base/tendermint/v1beta1/blocks/latest`, gotOpts).json()
const currentBlockTime = new Date(currentBlock.block.header.time) / 1000
const currentBlockHeight = currentBlock.block.header.height
const prevBlock = await got.get(`${restUrl}cosmos/base/tendermint/v1beta1/blocks/${currentBlockHeight - 100}`, gotOpts).json()
const blocksToCompare = process.env.BLOCKS_TO_COMPARE || 1000
const prevBlock = await got.get(`${restUrl}cosmos/base/tendermint/v1beta1/blocks/${currentBlockHeight - blocksToCompare}`, gotOpts).json()
const prevBlockTime = new Date(prevBlock.block.header.time) / 1000
const prevBlockHeight = prevBlock.block.header.height
const actualBlockTime = (currentBlockTime - prevBlockTime) / (currentBlockHeight - prevBlockHeight)
Expand Down

0 comments on commit 68e6ac2

Please sign in to comment.