diff options
author | Dimitry <winsvega@mail.ru> | 2016-06-13 21:17:56 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-06-29 05:18:54 +0800 |
commit | 874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf (patch) | |
tree | 9ec0254d130bdaaa56deed6f274e99406419666c /test | |
parent | d6e39054e01cd956e9e476e9a10a4246e9579356 (diff) | |
download | dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar.gz dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar.bz2 dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar.lz dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar.xz dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.tar.zst dexon-solidity-874a16bed4232d2c1fb79ee34e1a2e8f3ba89bdf.zip |
fix rpc mining
Diffstat (limited to 'test')
-rw-r--r-- | test/IPCSocket.cpp | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/test/IPCSocket.cpp b/test/IPCSocket.cpp index 77a8e176..b7b2572b 100644 --- a/test/IPCSocket.cpp +++ b/test/IPCSocket.cpp @@ -148,24 +148,16 @@ void RPCSession::test_mineBlocks(int _number) u256 startBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())); u256 currentBlock = startBlock; u256 targetBlock = startBlock + _number; - cout << "A" << endl; - for (size_t tries = 0; tries < 3 && startBlock < targetBlock; ++tries) + cout << "MINE" << endl; + rpcCall("test_mineBlocks", { (targetBlock - startBlock).str() }, 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) { - if (currentBlock == startBlock) - { - cout << "MINE" << endl; - rpcCall("test_mineBlocks", { (targetBlock - startBlock).str() }, true); - } - cout << "WOIT" << endl; - startBlock = currentBlock; - //@TODO do not use polling - but that would probably need a change to the test client - for (size_t polls = 0; polls < 10; ++polls) - { - currentBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())); - if (currentBlock >= targetBlock) - return; - std::this_thread::sleep_for(chrono::milliseconds(1)); - } + currentBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString())); + if (currentBlock >= targetBlock) + return; + std::this_thread::sleep_for(chrono::milliseconds(10)); //it does not work faster then 10 ms } } @@ -194,7 +186,9 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const& { if (_canFail) return Json::Value(); - BOOST_FAIL("Error on JSON-RPC call: " + result["error"].asString()); + + Json::Value jsonError = result["error"]; + BOOST_FAIL("Error on JSON-RPC call: " + jsonError["message"].asString()); } return result["result"]; } |