mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-29 07:25:51 +00:00
Change RPC ledger params to just current and closed.
This commit is contained in:
@@ -174,7 +174,7 @@ Json::Value RPCParser::parseGetCounts(const Json::Value& jvParams)
|
|||||||
return jvRequest;
|
return jvRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ledger [id|ledger_current|ledger_closed] [full]
|
// ledger [id|index|current|closed] [full]
|
||||||
Json::Value RPCParser::parseLedger(const Json::Value& jvParams)
|
Json::Value RPCParser::parseLedger(const Json::Value& jvParams)
|
||||||
{
|
{
|
||||||
Json::Value jvRequest(Json::objectValue);
|
Json::Value jvRequest(Json::objectValue);
|
||||||
@@ -186,10 +186,14 @@ Json::Value RPCParser::parseLedger(const Json::Value& jvParams)
|
|||||||
|
|
||||||
std::string strLedger = jvParams[0u].asString();
|
std::string strLedger = jvParams[0u].asString();
|
||||||
|
|
||||||
if (strLedger == "current" || strLedger == "ledger_closed" || strLedger.length() > 12)
|
if (strLedger == "current" || strLedger == "closed" || strLedger.length() > 12)
|
||||||
|
{
|
||||||
jvRequest["ledger"] = strLedger;
|
jvRequest["ledger"] = strLedger;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
jvRequest["ledger"] = lexical_cast_s<uint32>(strLedger);
|
jvRequest["ledger"] = lexical_cast_s<uint32>(strLedger);
|
||||||
|
}
|
||||||
|
|
||||||
if (2 == jvParams.size() && jvParams[1u].asString() == "full")
|
if (2 == jvParams.size() && jvParams[1u].asString() == "full")
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1196,9 +1196,9 @@ Json::Value RPCHandler::doLedgerCurrent(Json::Value)
|
|||||||
return jvResult;
|
return jvResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ledger [id|ledger_current|lastclosed] [full]
|
// ledger [id|index|current|closed] [full]
|
||||||
// {
|
// {
|
||||||
// ledger: 'ledger_current' | 'ledger_closed' | <hex> | <number>, // optional
|
// ledger: 'current' | 'closed' | <uint256> | <number>, // optional
|
||||||
// full: true | false // optional, defaults to false.
|
// full: true | false // optional, defaults to false.
|
||||||
// }
|
// }
|
||||||
Json::Value RPCHandler::doLedger(Json::Value jvRequest)
|
Json::Value RPCHandler::doLedger(Json::Value jvRequest)
|
||||||
@@ -1219,9 +1219,9 @@ Json::Value RPCHandler::doLedger(Json::Value jvRequest)
|
|||||||
std::string strLedger = jvRequest["ledger"].asString();
|
std::string strLedger = jvRequest["ledger"].asString();
|
||||||
Ledger::pointer ledger;
|
Ledger::pointer ledger;
|
||||||
|
|
||||||
if (strLedger == "ledger_current")
|
if (strLedger == "current")
|
||||||
ledger = theApp->getLedgerMaster().getCurrentLedger();
|
ledger = theApp->getLedgerMaster().getCurrentLedger();
|
||||||
else if (strLedger == "ledger_closed")
|
else if (strLedger == "closed")
|
||||||
ledger = theApp->getLedgerMaster().getClosedLedger();
|
ledger = theApp->getLedgerMaster().getClosedLedger();
|
||||||
else if (strLedger.size() > 12)
|
else if (strLedger.size() > 12)
|
||||||
ledger = theApp->getLedgerMaster().getLedgerByHash(uint256(strLedger));
|
ledger = theApp->getLedgerMaster().getLedgerByHash(uint256(strLedger));
|
||||||
|
|||||||
Reference in New Issue
Block a user