ensure lgrInfo is in context.range (#226)

This commit is contained in:
Nathan Nichols
2022-07-26 13:35:48 -05:00
committed by GitHub
parent ce60c8f64d
commit 28980734ae

View File

@@ -569,7 +569,7 @@ ledgerInfoFromRequest(Context const& ctx)
auto lgrInfo = ctx.backend->fetchLedgerByHash(ledgerHash, ctx.yield);
if (!lgrInfo)
if (!lgrInfo || lgrInfo->seq > ctx.range.maxSequence)
return Status{Error::rpcLGR_NOT_FOUND, "ledgerNotFound"};
return *lgrInfo;
@@ -604,7 +604,7 @@ ledgerInfoFromRequest(Context const& ctx)
auto lgrInfo =
ctx.backend->fetchLedgerBySequence(*ledgerSequence, ctx.yield);
if (!lgrInfo)
if (!lgrInfo || lgrInfo->seq > ctx.range.maxSequence)
return Status{Error::rpcLGR_NOT_FOUND, "ledgerNotFound"};
return *lgrInfo;