Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
winsvega authored and chriseth committed Jun 28, 2016
1 parent 874a16b commit 603bad3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/IPCSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,10 @@ void RPCSession::test_rewindToBlock(size_t _blockNr)

void RPCSession::test_mineBlocks(int _number)
{
// Extremely complicated mechanism because sometimes the miner breaks and stops mining.
u256 startBlock = fromBigEndian<u256>(fromHex(rpcCall("eth_blockNumber").asString()));
u256 currentBlock = startBlock;
u256 targetBlock = startBlock + _number;
cout << "MINE" << endl;
rpcCall("test_mineBlocks", { (targetBlock - startBlock).str() }, true);
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)
Expand All @@ -159,6 +157,8 @@ void RPCSession::test_mineBlocks(int _number)
return;
std::this_thread::sleep_for(chrono::milliseconds(10)); //it does not work faster then 10 ms
}

BOOST_FAIL("Error in test_mineBlocks: block mining timeout!");
}

Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const& _args, bool _canFail)
Expand Down Expand Up @@ -187,8 +187,7 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const&
if (_canFail)
return Json::Value();

Json::Value jsonError = result["error"];
BOOST_FAIL("Error on JSON-RPC call: " + jsonError["message"].asString());
BOOST_FAIL("Error on JSON-RPC call: " + result["error"]["message"].asString());
}
return result["result"];
}
Expand Down

0 comments on commit 603bad3

Please sign in to comment.