decred / dcrd

Decred daemon in Go (golang).
https://decred.org
ISC License
731 stars 288 forks source link

netsync: Remove spent PRs from prev block txs #3334

Closed jrick closed 3 months ago

jrick commented 3 months ago

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.