From ffa5c58b327d48fad760e3d91ab7dedcfa4290f1 Mon Sep 17 00:00:00 2001 From: CJ Cobb <46455409+cjcobb23@users.noreply.github.com> Date: Tue, 8 Nov 2022 09:28:43 -0500 Subject: [PATCH] Return actNotFound for non-existent account in traverseOwnedNodes (#382) --- src/rpc/RPCHelpers.cpp | 4 ++++ src/rpc/handlers/GatewayBalances.cpp | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/rpc/RPCHelpers.cpp b/src/rpc/RPCHelpers.cpp index 32f6c318..a1e7d015 100644 --- a/src/rpc/RPCHelpers.cpp +++ b/src/rpc/RPCHelpers.cpp @@ -663,6 +663,10 @@ traverseOwnedNodes( boost::asio::yield_context& yield, std::function atOwnedNode) { + if (!backend.fetchLedgerObject( + ripple::keylet::account(accountID).key, sequence, yield)) + return Status{Error::rpcACT_NOT_FOUND}; + auto parsedCursor = parseAccountCursor(backend, sequence, jsonCursor, accountID, yield); diff --git a/src/rpc/handlers/GatewayBalances.cpp b/src/rpc/handlers/GatewayBalances.cpp index 70303008..ee56b8b8 100644 --- a/src/rpc/handlers/GatewayBalances.cpp +++ b/src/rpc/handlers/GatewayBalances.cpp @@ -138,7 +138,7 @@ doGatewayBalances(Context const& context) return true; }; - traverseOwnedNodes( + auto result = traverseOwnedNodes( *context.backend, accountID, lgrInfo.seq, @@ -146,6 +146,8 @@ doGatewayBalances(Context const& context) {}, context.yield, addToResponse); + if (auto status = std::get_if(&result)) + return *status; if (!sums.empty()) {