bitshares1-core icon indicating copy to clipboard operation
bitshares1-core copied to clipboard

Allow to truncate blockchain

Open theoreticalbts opened this issue 10 years ago • 3 comments

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.

theoreticalbts avatar Dec 17 '14 13:12 theoreticalbts

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()

nathanielhourt avatar Dec 17 '14 13:12 nathanielhourt

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.

theoreticalbts avatar Dec 17 '14 13:12 theoreticalbts

If you need to rewind more than max undo history, yes, you'll need to completely reindex.

nathanielhourt avatar Dec 17 '14 18:12 nathanielhourt