netsync: Remove spent PRs from prev block txs #3334
Merged
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.
Instead of removing PRs spent by the latest tip block attached to the main chain, use the previous block. The goal of this is to avoid immediately removing mixpool messages that are still propagating the network when a block was quickly mined which includes transactions created from those very same mix messages.
After taking a second look at this, this method of removing completed sessions from mixpool does not deal well with reorgs. Using the previous block for every main chain tip extension or reorg will work better, but will still not handle a 2+ block reorg properly. However, these mixpool messages are only removed to avoid a memory leak, and the messages would simply be removed at a later time due to PR expiry.