hsd icon indicating copy to clipboard operation
hsd copied to clipboard

Mempool: handle covenant conflicts during reorg and save TXs for later if possible

Open pinheadmz opened this issue 2 years ago • 1 comments

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.

pinheadmz avatar Oct 07 '22 20:10 pinheadmz

Coverage Status

Coverage increased (+0.1%) to 68.056% when pulling 0c7d0a861069fbf9c44369ae957173902b013226 on pinheadmz:handle-reorg-mempool into 6f112121aeba51c63ffb36d8351fb7a7bf9ebfe1 on handshake-org:master.

coveralls avatar Oct 10 '22 13:10 coveralls