From 28980734ae68d0193d1b2e6166ccb970117842ef Mon Sep 17 00:00:00 2001 From: Nathan Nichols Date: Tue, 26 Jul 2022 13:35:48 -0500 Subject: [PATCH] ensure lgrInfo is in context.range (#226) --- src/rpc/RPCHelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rpc/RPCHelpers.cpp b/src/rpc/RPCHelpers.cpp index b33e3599..cdd19e1a 100644 --- a/src/rpc/RPCHelpers.cpp +++ b/src/rpc/RPCHelpers.cpp @@ -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;