Avoid cloning block in EngineApiTreeHandler::insert_block
#13698
Labels
C-debt
Refactor of code section that is hard to understand or maintain
C-enhancement
New feature or request
Describe the feature
In
EngineApiTreeHandler::insert_block
, it is desirable to include block in the error and return it whenEngineApiTreeHandler::insert_block_inner
is unsuccessful. However,insert_block_inner
needs to take ownership of block, so a clone of block is made. CloningSealedBlockWithSenders
involves deep copying of transactions, receipts, etc., which is a costly operation. Sinceinsert_block_inner
typically returns OK, always performing a costly operation for a rare exceptional case is not considered best practice.EngineApiTreeHandler::insert_block_inner
appears to be called only byEngineApiTreeHandler::insert_block
. So could we letinsert_block_inner
directly returnInsertBlockErrorTwo
in case of an exception to avoid cloning the block?If you find this suggestion reasonable, please assign this issue to me. I am very expected to contribute to the project!
Additional context
No response
The text was updated successfully, but these errors were encountered: