Is there a command or an easy way to rollback the changes to a node's RocksDb to force the node to go back in its history and start fresh from previous block numbers? For example if the node has seen and synced with n
blocks so far but you want to stop the node, remove whatever led to n
and force the node to start from n-1
?
1 Answer
It depends.
- If block n is finalized which is the most possible case, then there's no easy way to achieve this goal. You can only fork this chain, and start a new chain. You can fork in the following ways: 1) export all blocks from old chain, and then import them into new chain. 2) use tools like fork-off-substrate, read the raw storage with blockNum = n - 1, and then write raw storage in chainspec.
- If block n is not finalized and you can control most of the validators, which you can see has many constraints, you can run command: ./target/release/ revert.