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:
parent
e7f3dc3dae
commit
3326c4fe74
|
@ -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];
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue