1

I've been reading confusing information online about what the --reindex startup parameter does.

This link is not clear to me.

https://github.com/bitcoin/bitcoin/blob/631df3ee87ec93e1fc748715671cdb5cff7308e6/src/init.cpp#L388

gArgs.AddArg("-reindex", "Rebuild chain state and block index from the blk*.dat files on disk", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);

So, if I am on a fork because a mandatory upgrade occurred, I did not know about it, and I am no longer on the main chain, would a --reindex fix this?

3

No, it would not. --reindex only handles the data that is stored on disk. Blocks are stored in the order that they are received, which is what brought you to your current view of the blockchain. So all that would happen is that you end up at that same state.

Switching to another blockchain fork requires your node to be aware of it, so you need to have received those blocks from another node and they will be on your disk. If that chain is truly valid and has more work, then your node will have switched to it without a reindex.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.