error when marker does not exist (#167)

This commit is contained in:
Nathan Nichols
2022-06-15 16:18:45 -05:00
committed by GitHub
parent 166ff63dbc
commit 14a972c8e2
2 changed files with 8 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ doLedgerData(Context const& context)
return *status;
auto lgrInfo = std::get<ripple::LedgerInfo>(v);
boost::json::object header;
// no marker means this is the first call, so we return header info
if (!marker)
@@ -106,6 +107,13 @@ doLedgerData(Context const& context)
response[JS(ledger)] = header;
}
}
else
{
if (!outOfOrder &&
!context.backend->fetchLedgerObject(
*marker, lgrInfo.seq, context.yield))
return Status{Error::rpcINVALID_PARAMS, "markerDoesNotExist"};
}
response[JS(ledger_hash)] = ripple::strHex(lgrInfo.hash);
response[JS(ledger_index)] = lgrInfo.seq;