Browse Source

Check for new blocks

refactor
Hampus Sjöberg 4 years ago
parent
commit
d385d92e6b
  1. 12
      blocks.ts

12
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.");
}

Loading…
Cancel
Save