aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-13 22:10:02 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-02-13 22:11:03 +0800
commite9dd9d2c7220594e2731b081990396429c5288d7 (patch)
tree3e049c84b15c4ab9cb329fca5c9e981c006e730a /test
parent1d4ef87bb11e447334d2dea99b5a70c7201d6b97 (diff)
downloaddexon-solidity-e9dd9d2c7220594e2731b081990396429c5288d7.tar.gz
dexon-solidity-e9dd9d2c7220594e2731b081990396429c5288d7.tar.zst
dexon-solidity-e9dd9d2c7220594e2731b081990396429c5288d7.zip
Simplify mining loop
Diffstat (limited to 'test')
-rw-r--r--test/RPCSession.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp
index 613d042a..bf639e19 100644
--- a/test/RPCSession.cpp
+++ b/test/RPCSession.cpp
@@ -243,22 +243,20 @@ void RPCSession::test_mineBlocks(int _number)
u256 startBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString()));
BOOST_REQUIRE(rpcCall("test_mineBlocks", { to_string(_number) }, true) == true);
- bool mined = false;
-
// We auto-calibrate the time it takes to mine the transaction.
// It would be better to go without polling, but that would probably need a change to the test client
unsigned startTime = boost::posix_time::microsec_clock::local_time();
unsigned sleepTime = m_sleepTime;
size_t tries = 0;
- for (; !mined; ++tries)
+ for (; ; ++tries)
{
std::this_thread::sleep_for(chrono::milliseconds(sleepTime));
boost::posix_time::time_duration timeSpent = boost::posix_time::microsec_clock::local_time() - startTime;
if (timeSpent > m_maxMiningTime)
- break;
+ BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number)
- mined = true;
+ break;
else
sleepTime *= 2;
}
@@ -277,9 +275,6 @@ void RPCSession::test_mineBlocks(int _number)
m_sleepTime--;
}
}
-
- if (!mined)
- BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
}
void RPCSession::test_modifyTimestamp(size_t _timestamp)