diff --git a/src/ripple/net/impl/RPCCall.cpp b/src/ripple/net/impl/RPCCall.cpp index c9c09351471..ed3848826bb 100644 --- a/src/ripple/net/impl/RPCCall.cpp +++ b/src/ripple/net/impl/RPCCall.cpp @@ -458,7 +458,7 @@ class RPCParser if (reader.parse (jvParams[2u].asString (), txJSON)) { // sign_for txJSON. - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::account] = jvParams[0u].asString (); jvRequest[jss::secret] = jvParams[1u].asString (); @@ -802,7 +802,7 @@ class RPCParser Json::Value parseRipplePathFind (Json::Value const& jvParams) { Json::Reader reader; - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; bool bLedger = 2 == jvParams.size (); JLOG (j_.trace()) << "RPC json: " << jvParams[0u]; @@ -835,7 +835,7 @@ class RPCParser { // Submitting tx_blob - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::tx_blob] = jvParams[0u].asString (); @@ -845,7 +845,7 @@ class RPCParser && reader.parse (jvParams[1u].asString (), txJSON)) { // Signing or submitting tx_json. - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::secret] = jvParams[0u].asString (); jvRequest[jss::tx_json] = txJSON; @@ -870,7 +870,7 @@ class RPCParser Json::Reader reader; if (reader.parse (jvParams[0u].asString (), txJSON)) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::tx_json] = txJSON; return jvRequest; } @@ -889,7 +889,7 @@ class RPCParser if (txHash.length() != 64) return rpcError (rpcINVALID_PARAMS); - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::tx_hash] = txHash; jvParseLedger (jvRequest, jvParams[1u].asString()); @@ -907,7 +907,7 @@ class RPCParser // tx Json::Value parseTx (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; if (jvParams.size () > 1) { @@ -922,7 +922,7 @@ class RPCParser // tx_history Json::Value parseTxHistory (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; jvRequest[jss::start] = jvParams[0u].asUInt (); @@ -935,7 +935,7 @@ class RPCParser // shell history file (e.g. .bash_history) and it may be leaked via the process status command (i.e. ps). Json::Value parseValidationCreate (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; if (jvParams.size ()) jvRequest[jss::secret] = jvParams[0u].asString (); @@ -949,7 +949,7 @@ class RPCParser // shell history file (e.g. .bash_history) and it may be leaked via the process status command (i.e. ps). Json::Value parseValidationSeed (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; if (jvParams.size ()) jvRequest[jss::secret] = jvParams[0u].asString (); @@ -961,7 +961,7 @@ class RPCParser // is only for testing. Master seeds should only be generated randomly. Json::Value parseWalletPropose (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; if (jvParams.size ()) jvRequest[jss::passphrase] = jvParams[0u].asString (); @@ -972,7 +972,7 @@ class RPCParser // wallet_seed [||] Json::Value parseWalletSeed (Json::Value const& jvParams) { - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; if (jvParams.size ()) jvRequest[jss::secret] = jvParams[0u].asString (); @@ -988,7 +988,7 @@ class RPCParser unsigned int index = 0; const unsigned int size = jvParams.size (); - Json::Value jvRequest; + Json::Value jvRequest{Json::objectValue}; std::string param = jvParams[index++].asString (); if (param.empty ()) diff --git a/src/test/rpc/ValidatorRPC_test.cpp b/src/test/rpc/ValidatorRPC_test.cpp index 87ea06bf318..abffdb3b6b3 100644 --- a/src/test/rpc/ValidatorRPC_test.cpp +++ b/src/test/rpc/ValidatorRPC_test.cpp @@ -385,12 +385,27 @@ class ValidatorRPC_test : public beast::unit_test::suite } } + void + test_validation_create() + { + using namespace test::jtx; + Env env{*this}; + auto result = env.rpc("validation_create"); + BEAST_EXPECT(result.isMember(jss::result) && + result[jss::result][jss::status] == "success"); + result = env.rpc("validation_create", + "BAWL MAN JADE MOON DOVE GEM SON NOW HAD ADEN GLOW TIRE"); + BEAST_EXPECT(result.isMember(jss::result) && + result[jss::result][jss::status] == "success"); + } + void run() { testPrivileges(); testStaticUNL(); testDynamicUNL(); + test_validation_create(); } };