fix: Check ledger range in every handler (#1755)

fixes #1565
This commit is contained in:
Peter Chen
2024-11-29 10:11:07 -05:00
committed by GitHub
parent f62fadc9f9
commit fe4f95dabd
47 changed files with 377 additions and 25 deletions

View File

@@ -27,6 +27,7 @@
#include "rpc/common/Specs.hpp"
#include "rpc/common/Types.hpp"
#include "rpc/common/Validators.hpp"
#include "util/Assert.hpp"
#include <boost/json/conversion.hpp>
#include <boost/json/value.hpp>
@@ -56,6 +57,8 @@ FeatureHandler::process(FeatureHandler::Input input, Context const& ctx) const
namespace rg = std::ranges;
auto const range = sharedPtrBackend_->fetchLedgerRange();
ASSERT(range.has_value(), "Feature's ledger range must be available");
auto const lgrInfoOrStatus = getLedgerHeaderFromHashOrSeq(
*sharedPtrBackend_, ctx.yield, input.ledgerHash, input.ledgerIndex, range->maxSequence
);