mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Amendment RPC enhancements:
* RPC command to veto/unveto * Store votes * Add vote information to JSON * Add ledger majority information to JSON * Config section for vetos
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
#include <ripple/protocol/types.h>
|
||||
#include <ripple/server/ServerHandler.h>
|
||||
#include <beast/module/core/text/LexicalCast.h>
|
||||
#include <beast/utility/ci_char_traits.h>
|
||||
#include <boost/asio/streambuf.hpp>
|
||||
#include <boost/regex.hpp>
|
||||
#include <iostream>
|
||||
@@ -406,16 +407,28 @@ private:
|
||||
return rpcError (rpcNO_EVENTS);
|
||||
}
|
||||
|
||||
// feature [<feature>] [true|false]
|
||||
// feature [<feature>] [accept|reject]
|
||||
Json::Value parseFeature (Json::Value const& jvParams)
|
||||
{
|
||||
Json::Value jvRequest (Json::objectValue);
|
||||
|
||||
if (jvParams.size () > 0)
|
||||
jvRequest[jss::feature] = jvParams[0u].asString ();
|
||||
jvRequest[jss::feature] = jvParams[0u].asString ();
|
||||
|
||||
if (jvParams.size () > 1)
|
||||
jvRequest[jss::vote] = beast::lexicalCastThrow <bool> (jvParams[1u].asString ());
|
||||
{
|
||||
auto const action = jvParams[1u].asString ();
|
||||
|
||||
// This may look reversed, but it's intentional: jss::vetoed
|
||||
// determines whether an amendment is vetoed - so "reject" means
|
||||
// that jss::vetoed is true.
|
||||
if (beast::ci_equal(action, "reject"))
|
||||
jvRequest[jss::vetoed] = Json::Value (true);
|
||||
else if (beast::ci_equal(action, "accept"))
|
||||
jvRequest[jss::vetoed] = Json::Value (false);
|
||||
else
|
||||
return rpcError (rpcINVALID_PARAMS);
|
||||
}
|
||||
|
||||
return jvRequest;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user