hsd
hsd copied to clipboard
Mempool: handle covenant conflicts during reorg and save TXs for later if possible
This PR should improve UX and increase miner fee profits after reorgs and in some edge cases involving covenant conflicts.
There are some covenants that can not coexist in a block, for example UPDATE
can only happen once per name per block. That also means that at any time in the mempool, there can only be one UPDATE
per name. After a reorginzation when transactions get removed from blocks and re-enter the mempool, we need to track these conflicts carefully and make sure that "the next valid transaction" in the covenant chain is the only covenant for a given name in the mempool.
By storing the conflicting TXs outside the mempool in a new data structure, a miner can still earn fees LATER when the parent TXs confirm and the child TXs are once again valid.