From b538a8a81467a72bf2e407bbfd56dc3bbf9198a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20M=C3=A4kel=C3=A4?= Date: Tue, 21 Aug 2018 16:30:23 +0300 Subject: [PATCH] hopefully fixed blocknumber handling --- contracts/IncentiveLayer.sol | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/contracts/IncentiveLayer.sol b/contracts/IncentiveLayer.sol index 6f18ea0..82256bb 100644 --- a/contracts/IncentiveLayer.sol +++ b/contracts/IncentiveLayer.sol @@ -61,7 +61,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager { bytes32 initTaskHash; mapping(address => bytes32) challenges; State state; - bytes32 blockhash; bytes32 randomBitsHash; uint taskCreationBlockNumber; mapping(address => uint) bondedDeposits; @@ -244,7 +243,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager { bondDeposit(taskID, msg.sender, t.minDeposit); t.selectedSolver = msg.sender; t.randomBitsHash = randomBitsHash; - t.blockhash = blockhash(block.number.add(1)); t.state = State.SolverSelected; // Burn task giver's taxes now that someone has claimed the task @@ -271,7 +269,6 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager { bondDeposit(taskID, msg.sender, t.minDeposit); t.selectedSolver = msg.sender; t.randomBitsHash = randomBitsHash; - t.blockhash = blockhash(block.number.add(1)); t.state = State.SolverSelected; emit SolverSelected(taskID, msg.sender, t.initTaskHash, t.minDeposit, t.randomBitsHash); @@ -396,7 +393,7 @@ contract IncentiveLayer is JackpotManager, DepositsManager, RewardsManager { } function isForcedError(uint randomBits) internal view returns (bool) { - return (uint(keccak256(abi.encodePacked(randomBits, blockhash(block.number)))) < forcedErrorThreshold); + return (uint(keccak256(abi.encodePacked(randomBits, blockhash(block.number-1)))) < forcedErrorThreshold); } function rewardJackpot(uint taskID) internal {