diff --git a/test/RPCSession.cpp b/test/RPCSession.cpp index 608481189..1d685bf1b 100644 --- a/test/RPCSession.cpp +++ b/test/RPCSession.cpp @@ -326,6 +326,14 @@ Json::Value RPCSession::rpcCall(string const& _methodName, vector const& if (!jsonParseStrict(reply, result, &errorMsg)) BOOST_REQUIRE_MESSAGE(false, 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")) { if (_canFail)