diff options
author | chriseth <c@ethdev.com> | 2016-08-06 17:55:37 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-08-12 21:11:31 +0800 |
commit | 53f68a155f071194fd779352d5997c03a6c387ed (patch) | |
tree | 90403ba5f95c439bd1d9da5f8813a21bf4caed47 /test/RPCSession.cpp | |
parent | 1bc0320811ef2b213bda0629b702bffae5e2f925 (diff) | |
download | dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar.gz dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar.bz2 dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar.lz dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar.xz dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.tar.zst dexon-solidity-53f68a155f071194fd779352d5997c03a6c387ed.zip |
Exponential sleep increase on mining failure.
Diffstat (limited to 'test/RPCSession.cpp')
-rw-r--r-- | test/RPCSession.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp index 8ed9e9ac..43ad26e1 100644 --- a/test/RPCSession.cpp +++ b/test/RPCSession.cpp @@ -245,11 +245,15 @@ void RPCSession::test_mineBlocks(int _number) rpcCall("test_mineBlocks", { to_string(_number) }, true); //@TODO do not use polling - but that would probably need a change to the test client - for (size_t polls = 0; polls < 100; ++polls) + unsigned sleepTime = 10; + for (size_t polls = 0; polls < 10; ++polls) { if (fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())) >= startBlock + _number) return; - std::this_thread::sleep_for(chrono::milliseconds(10)); //it does not work faster then 10 ms + std::this_thread::sleep_for(chrono::milliseconds(sleepTime)); + if (sleepTime > 500) + cout << "Mining timeout, sleeping for " << sleepTime << " ms" << endl; + sleepTime *= 2; } BOOST_FAIL("Error in test_mineBlocks: block mining timeout!"); |