From d385d92e6b0ae89d0687ff84fc46f47bd5314df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hampus=20Sj=C3=B6berg?= Date: Tue, 27 Apr 2021 13:13:52 +0200 Subject: [PATCH] Check for new blocks --- blocks.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/blocks.ts b/blocks.ts index 9e7b412..759cc1a 100644 --- a/blocks.ts +++ b/blocks.ts @@ -41,6 +41,18 @@ export async function bootstrapBlocks() { } } + setInterval(async () => { + console.log("Checking for new blocks"); + const newBlockCount = await getblockcount(); + if (newBlockCount > blockCount) { + for (let i = blockCount; i < newBlockCount; i++) { + const blockHash = await getblockhash(i + 1); + const blockheader = await getblockheader(blockHash); + blocks[i % 2016].signals = (blockheader.version & (config.fork.versionBit + 1)) === config.fork.versionBit + 1; + } + } + }, 10 * 1000); + console.log("Done."); }