Skip to content

Commit

Permalink
rpcdaemon: fix debug_storageRangeAt response for non-existent block h…
Browse files Browse the repository at this point in the history
…ash (#1948)
  • Loading branch information
Sixtysixter authored Mar 29, 2024
1 parent efa0e73 commit 81852c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions silkworm/rpc/commands/debug_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ Task<void> DebugRpcApi::handle_debug_storage_range_at(const nlohmann::json& requ

const auto block_with_hash = co_await core::read_block_by_hash(*block_cache_, *chain_storage, block_hash);
if (!block_with_hash) {
const std::string error_msg = "block not found ";
SILK_ERROR << "debug_storage_range_at: core::read_block_by_hash: " << error_msg << request.dump();
reply = make_json_error(request, -32000, error_msg);
SILK_WARN << "debug_storage_range_at: block not found, hash: " << evmc::hex(block_hash);
nlohmann::json result = {{"storage", nullptr}, {"nextKey", nullptr}};
reply = make_json_content(request, result);

co_await tx->close(); // RAII not (yet) available with coroutines
co_return;
}
Expand Down

0 comments on commit 81852c0

Please sign in to comment.