Improve ledger_request response

This commit is contained in:
Miguel Portilla
2015-12-09 17:35:38 -05:00
committed by Nik Bougalis
parent 4f40e94c99
commit cb280b10c1
2 changed files with 12 additions and 4 deletions

View File

@@ -72,6 +72,7 @@ JSS ( accounts ); // in: LedgerEntry, Subscribe,
// out: WalletAccounts
JSS ( accounts_proposed ); // in: Subscribe, Unsubscribe
JSS ( action );
JSS ( acquiring ); // out: LedgerRequest
JSS ( address ); // out: PeerImp
JSS ( affected ); // out: AcceptedLedgerTx
JSS ( age ); // out: UniqueNodeList, NetworkOPs, Peers

View File

@@ -89,13 +89,20 @@ Json::Value doLedgerRequest (RPC::Context& context)
if (auto il = context.app.getInboundLedgers().acquire (
*refHash, refIndex, InboundLedger::fcGENERIC))
return getJson (LedgerFill (*il));
{
Json::Value jvResult = RPC::make_error(
rpcLGR_NOT_FOUND,
"acquiring ledger containing requested index");
jvResult[jss::acquiring] = getJson (LedgerFill (*il));
return jvResult;
}
if (auto il = context.app.getInboundLedgers().find (*refHash))
{
Json::Value jvResult = il->getJson (0);
jvResult[jss::error] = "ledgerNotFound";
Json::Value jvResult = RPC::make_error(
rpcLGR_NOT_FOUND,
"acquiring ledger containing requested index");
jvResult[jss::acquiring] = il->getJson (0);
return jvResult;
}