Add logging to catch scenario when processing of transactions is aborted due to New Head event #1220
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is to allow detection of an issue that can occur on Istanbul/Clique. The issue occurs if the block gas is set sufficiently high that transactions fitting into a block take longer to process than the block period.
In this case, a New Head event is received during processing of pending transaction, which aborts the transaction processing loop.
As a result, the transactions remain stuck on txpool and are never included in a block.
Original issue ticket has now been lost due to archival of that repo. However, here is an extract from the Slack discussion:
"I've reproduced the issue and can confirm that the behaviour is as discussed on the call, i.e. if the pending transactions take less than the block gasLimit to process, but take greater than the blockTime to process, then they will be stuck in pending.
The reason this happens is that during processing of the transactions, a 'New Head' event occurs which aborts the processing of the transactions.
You can see the code for this in worker.go::commitTransactions() where the loop to process transactions will complete when any of the following occurs:
Therefore you do need to ensure that the block gasLimit is not excessive in comparison to the block period."