Skip to content

Commit

Permalink
rpcdaemon: fix in case of receipts size mismatch (#2338)
Browse files Browse the repository at this point in the history
  • Loading branch information
lupin012 authored Sep 11, 2024
1 parent 96b6207 commit 62a43f7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions silkworm/rpc/commands/erigon_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ Task<void> 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));
}
Expand Down

0 comments on commit 62a43f7

Please sign in to comment.