Make isProofRequired() work for the current block

The block hash of the current block is not known yet, so
we use the block hash of the previous block to determine
whether a proof is required for a block.
This commit is contained in:
Mark Spanbroek 2021-11-03 13:18:08 +01:00
parent e7f3dc3dae
commit 3326c4fe74
2 changed files with 2 additions and 2 deletions

View File

@ -50,7 +50,7 @@ contract Proofs {
internal view
returns (bool)
{
bytes32 hash = blockhash(blocknumber);
bytes32 hash = blockhash(blocknumber - 1);
return hash != 0 && uint(hash) % periods[id] == markers[id];
}

View File

@ -45,7 +45,7 @@ describe("Proofs", function () {
}
async function minedBlockNumber() {
return await ethers.provider.getBlockNumber() - 1
return await ethers.provider.getBlockNumber()
}
async function mineUntilProofIsRequired(id) {