From 816207618d7a5ce9679ac9b30041bb768ba4bd11 Mon Sep 17 00:00:00 2001 From: CJ Cobb Date: Wed, 9 Jun 2021 20:34:54 +0000 Subject: [PATCH] fix ledger index check in shouldForwardToRippled --- server/session.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server/session.cpp b/server/session.cpp index ae0bd14fe..97dd0206e 100644 --- a/server/session.cpp +++ b/server/session.cpp @@ -11,10 +11,12 @@ shouldForwardToRippled(boost::json::object const& request) { if (request.contains("forward") && request.at("forward").is_bool()) return request.at("forward").as_bool(); + BOOST_LOG_TRIVIAL(info) << "checked forward"; std::string strCommand = request.contains("command") ? request.at("command").as_string().c_str() : request.at("method").as_string().c_str(); + BOOST_LOG_TRIVIAL(info) << "checked command"; if (forwardCommands.find(strCommand) != forwardCommands.end()) return true; @@ -22,12 +24,14 @@ shouldForwardToRippled(boost::json::object const& request) if (request.contains("ledger_index")) { auto indexValue = request.at("ledger_index"); - if (!indexValue.is_uint64()) + if (indexValue.is_string()) { + BOOST_LOG_TRIVIAL(info) << "checking ledger as string"; std::string index = indexValue.as_string().c_str(); return index == "current" || index == "closed"; } } + BOOST_LOG_TRIVIAL(info) << "checked ledger"; return false; } @@ -46,6 +50,7 @@ buildResponse( if (shouldForwardToRippled(request)) return {balancer->forwardToRippled(request), 10}; + BOOST_LOG_TRIVIAL(info) << "Not forwarding"; switch (commandMap[command]) { case tx: @@ -58,6 +63,8 @@ buildResponse( } case ledger: { auto res = doLedger(request, *backend); + + BOOST_LOG_TRIVIAL(info) << "did command"; if (res.contains("transactions")) return {res, res["transactions"].as_array().size()}; return {res, 1};