bug fixes in both backends. add ledger_range rpc. improve test scripts

This commit is contained in:
CJ Cobb
2021-03-05 16:46:55 -05:00
parent 7a6dfe5967
commit e3a121e571
13 changed files with 179 additions and 51 deletions

View File

@@ -169,7 +169,10 @@ doAccountTx(boost::json::object const& request, BackendInterface const& backend)
cursor = {*ledgerSequence, *transactionIndex};
}
constexpr uint32_t limit = 500;
uint32_t limit = 200;
if (request.contains("limit") and
request.at("limit").kind() == boost::json::kind::int64)
limit = request.at("limit").as_int64();
boost::json::array txns;
auto [blobs, retCursor] =
backend.fetchAccountTransactions(*account, limit, cursor);

View File

@@ -293,7 +293,7 @@ doBookOffers(
return response;
}
std::uint32_t limit = 500;
std::uint32_t limit = 200;
if (request.contains("limit") and
request.at("limit").kind() == boost::json::kind::int64)
limit = request.at("limit").as_int64();

View File

@@ -70,7 +70,7 @@ doLedgerData(
std::vector<Backend::LedgerObject>& results = page.objects;
std::optional<ripple::uint256> const& returnedCursor = page.cursor;
BOOST_LOG_TRIVIAL(debug)
<< "doUpperBound returned " << results.size() << " results";
<< __func__ << " number of results = " << results.size();
for (auto const& [key, object] : results)
{
ripple::STLedgerEntry sle{

22
handlers/LedgerRange.cpp Normal file
View File

@@ -0,0 +1,22 @@
#include <handlers/RPCHelpers.h>
#include <reporting/BackendInterface.h>
boost::json::object
doLedgerRange(
boost::json::object const& request,
BackendInterface const& backend)
{
boost::json::object response;
auto range = backend.fetchLedgerRange();
if (!range)
{
response["error"] = "No data";
}
else
{
response["ledger_index_min"] = range->minSequence;
response["ledger_index_max"] = range->maxSequence;
}
return response;
}