fix: ignore errors that caused by gap to keep peer connection #49
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.
Description
This PR is designed to address scenarios where dynamic-type peers in geth are too easily removed. In certain scenarios, we can increase the tolerance.
Rationale
In the context of opbnb, our block production rate and the number of transactions per block mean that there is a gap between the time geth finishes writing and the node's broadcast time. During this interval, for clients making requests to that node, it is possible that geth has not yet completed the persistence of the requested data at the moment of the request. This can trigger a peer disconnected event, even though the peer's status is actually healthy. Subsequently, extra waiting time is spent before the peer is added back. We would like peers in such situations to maintain the connection. When the block height is not more than a certain threshold behind, the connection should not be disconnected.
Example
N/A
Changes
Notable changes: