mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Disallow both single- and multi-signing in RPC (RIPD-1713):
The ledger already declared a transaction that is both single- and multi-signing malformed. This just adds some checking in the signing RPC commands (like submit and sign_for) which allows that sort of error to be identified a bit closer to the user. In the process of adding this code a bug was found in the RPCCall unit test. That bug is fixed as well.
This commit is contained in:
committed by
Nik Bougalis
parent
d8c450d272
commit
36d6758945
@@ -6970,10 +6970,20 @@ public:
|
||||
Json::Value exp;
|
||||
Json::Reader{}.parse (rpcCallTest.exp, exp);
|
||||
|
||||
// If there is an "error_code" field, remove it. Error codes
|
||||
// are not expected to stay stable between releases.
|
||||
got.removeMember ("error_code");
|
||||
exp.removeMember ("error_code");
|
||||
// Lambda to remove the "params[0u]:error_code" field if present.
|
||||
// Error codes are not expected to be stable between releases.
|
||||
auto rmErrorCode = [] (Json::Value& json)
|
||||
{
|
||||
if (json.isMember (jss::params) &&
|
||||
json[jss::params].isArray() &&
|
||||
json[jss::params].size() > 0 &&
|
||||
json[jss::params][0u].isObject())
|
||||
{
|
||||
json[jss::params][0u].removeMember (jss::error_code);
|
||||
}
|
||||
};
|
||||
rmErrorCode (got);
|
||||
rmErrorCode (exp);
|
||||
|
||||
// Pass if we didn't expect a throw and we got what we expected.
|
||||
if ((rpcCallTest.throwsWhat == RPCCallTestData::no_exception) &&
|
||||
|
||||
Reference in New Issue
Block a user