handle validated as ledger_index

This commit is contained in:
CJ Cobb
2021-06-23 16:52:45 +00:00
parent 0d2aef18b5
commit 2e00c0edcb
2 changed files with 9 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
#include <handlers/RPCHelpers.h>
#include <backend/BackendInterface.h>
#include <handlers/RPCHelpers.h>
std::optional<ripple::AccountID>
accountFromStringStrict(std::string const& account)
@@ -60,11 +60,8 @@ deserializeTxPlusMeta(
{
auto [tx, meta] = deserializeTxPlusMeta(blobs);
std::shared_ptr<ripple::TxMeta> m =
std::make_shared<ripple::TxMeta>(
tx->getTransactionID(),
seq,
*meta);
std::shared_ptr<ripple::TxMeta> m =
std::make_shared<ripple::TxMeta>(tx->getTransactionID(), seq, *meta);
return {tx, m};
}
@@ -85,9 +82,8 @@ toJson(ripple::STBase const& obj)
boost::json::value
getJson(Json::Value const& value)
{
boost::json::value boostValue =
boost::json::parse(value.toStyledString());
boost::json::value boostValue = boost::json::parse(value.toStyledString());
return boostValue;
}
@@ -147,7 +143,8 @@ ledgerSequenceFromRequest(
boost::json::object const& request,
BackendInterface const& backend)
{
if (not request.contains("ledger_index"))
if (!request.contains("ledger_index") ||
request.at("ledger_index").is_string())
{
return backend.fetchLatestLedgerSequence();
}

View File

@@ -681,7 +681,7 @@ import pathlib
numCalls = 0
async def ledgers(ip, port, minLedger, maxLedger, transactions, expand, maxCalls):
global numCalls
address = 'wss://' + str(ip) + ':' + str(port)
address = 'ws://' + str(ip) + ':' + str(port)
random.seed()
ledger = 0
ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
@@ -690,7 +690,7 @@ async def ledgers(ip, port, minLedger, maxLedger, transactions, expand, maxCalls
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
try:
async with websockets.connect(address,max_size=1000000000,ssl=ssl_context) as ws:
async with websockets.connect(address,max_size=1000000000) as ws:
global numCalls
for i in range(0, maxCalls):