From 69feaccd278842543d66ef7e053dec82c4f5e3ef Mon Sep 17 00:00:00 2001 From: lupin012 <58134934+lupin012@users.noreply.github.com> Date: Sun, 1 Sep 2024 18:49:45 +0200 Subject: [PATCH] provide null in case no tx present --- silkworm/rpc/commands/txpool_api.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/silkworm/rpc/commands/txpool_api.cpp b/silkworm/rpc/commands/txpool_api.cpp index 46bdc2724f..eae8555a6b 100644 --- a/silkworm/rpc/commands/txpool_api.cpp +++ b/silkworm/rpc/commands/txpool_api.cpp @@ -45,6 +45,10 @@ Task TxPoolRpcApi::handle_txpool_status(const nlohmann::json& request, nlo Task TxPoolRpcApi::handle_txpool_content(const nlohmann::json& request, nlohmann::json& reply) { try { const auto txpool_transactions = co_await tx_pool_->get_transactions(); + if (!txpool_transactions.size()) { + reply = make_json_content(request, nullptr); + co_return; + } TransactionContent transactions_content; transactions_content["queued"];