stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3k stars 659 forks source link

Miner Transaction Replay on Bitcoin Reorg #4313

Open AshtonStephens opened 5 months ago

AshtonStephens commented 5 months ago

Summary

Add a feature to the miner to replay Stacks transactions that were part of an invalid tenure due to a Bitcoin reorg.

Under Nakamoto, sortitions with a valid winner on the Bitcoin blockchain will yield a TenureChange that allows a new miner to produce blocks that the signers will sign, but a Bitcoin reorg can force the Stacks blockchain to reorganize because a Bitcoin block with a valid sortition can be orphaned itself, meaning that the orphaned tenures are now invalid. This ticket is to add a feature to the default Miner binary to have the miner replay transactions that were orphaned by a Bitcoin reorg to be included within the next tenure.

This ticket does not encompass including any kind of analysis on the validity of transactions, only prioritizing the replay of the transactions that were previously confirmed by a now invalid tenure.

Testing

Success Criteria

AshtonStephens commented 5 months ago

Changed the wording to Miner, because that's what should be doing the replay, and the signer should potentially be enforcing it. This ticket is just for the reference miner implementation.