From 62a43f76333316c3a24fb7645f32a3907e24eacf Mon Sep 17 00:00:00 2001 From: lupin012 <58134934+lupin012@users.noreply.github.com> Date: Wed, 11 Sep 2024 08:18:18 +0200 Subject: [PATCH] rpcdaemon: fix in case of receipts size mismatch (#2338) --- silkworm/rpc/commands/erigon_api.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/silkworm/rpc/commands/erigon_api.cpp b/silkworm/rpc/commands/erigon_api.cpp index 511d603a12..176fedd0c3 100644 --- a/silkworm/rpc/commands/erigon_api.cpp +++ b/silkworm/rpc/commands/erigon_api.cpp @@ -206,6 +206,13 @@ Task ErigonRpcApi::handle_erigon_get_block_receipts_by_block_hash(const nl SILK_TRACE << "#receipts: " << receipts.size(); const auto block{block_with_hash->block}; + if (block.transactions.size() != receipts.size()) { + SILK_ERROR << "erigon_get_block_receipts_by_block_hash: receipts size mismatch transaction size: " << request.dump(); + reply = make_json_content(request, {}); + co_await tx->close(); // RAII not (yet) available with coroutines + co_return; + } + for (size_t i{0}; i < block.transactions.size(); i++) { receipts[i].effective_gas_price = block.transactions[i].effective_gas_price(block.header.base_fee_per_gas.value_or(0)); }