mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #5907 from ethereum/rpcsession-check-id
Check message identifier in RPCSession
This commit is contained in:
commit
ddab3f06a5
@ -324,7 +324,15 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector<string> const&
|
||||
Json::Value result;
|
||||
string errorMsg;
|
||||
if (!jsonParseStrict(reply, result, &errorMsg))
|
||||
BOOST_REQUIRE_MESSAGE(false, errorMsg);
|
||||
BOOST_FAIL("Failed to parse JSON-RPC response: " + errorMsg);
|
||||
|
||||
if (!result.isMember("id") || !result["id"].isUInt())
|
||||
BOOST_FAIL("Badly formatted JSON-RPC response (missing or non-integer \"id\")");
|
||||
if (result["id"].asUInt() != (m_rpcSequence - 1))
|
||||
BOOST_FAIL(
|
||||
"Response identifier mismatch. "
|
||||
"Expected " + to_string(m_rpcSequence - 1) + " but got " + to_string(result["id"].asUInt()) + "."
|
||||
);
|
||||
|
||||
if (result.isMember("error"))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user