diff --git a/contracts/Proofs.sol b/contracts/Proofs.sol index 399f83a..e856c50 100644 --- a/contracts/Proofs.sol +++ b/contracts/Proofs.sol @@ -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]; } diff --git a/test/Proofs.test.js b/test/Proofs.test.js index c6a011f..1dcd350 100644 --- a/test/Proofs.test.js +++ b/test/Proofs.test.js @@ -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) {