Open theoreticalbts opened 9 years ago
The better solution here would be to simply expose a command to switch to fork containing a given block ID. There's no need to throw data away (that can be done later). Better to keep everything to allow us to switch back if need be.
Implementing this command should be trivial. Just call switch_to_fork()
Wouldn't you have to re-process from the beginning to update the chain state? I'm pretty sure there's some max undo length; in other words we don't keep the data to rewind the state arbitrarily far in the past.
If you need to rewind more than max undo history, yes, you'll need to completely reindex.
There should be an option to throw away blocks above a certain height (and probably need to throw away indexes as well). The idea is to make resolving a fork not require a full re-download of the blockchain.