When should I use -reindex-chainstate and when -reindex

20

14

What is the difference between the options -reindex and -reindex-chainstate?

Is one of the options faster?

When should each option be used?

amanusk

Posted 2017-10-14T18:34:56.550

Reputation: 363

Answers

30

-reindex:

  • wipes the chainstate (the UTXO set)
  • wipes the block index (the database with information about which block is where on disk)
  • rebuilds the block index (by going over all blk*.dat files, and finding things in it that look like blocks)
  • rebuilds the chainstate (redoing all validation for blocks) based on the blocks now in the index

-reindex-chainstate:

  • wipes the chainstate
  • rebuilds the chainstate using the blocks in the index you had before

The latter should be strictly faster, as it does not need to rebuild the block index first. Perhaps the progress bar during reindex confuses you: that progress is only for the rebuilding of the index. The recreation of the chainstate happens after that rebuild is completed.

You should use -reindex only when you were running in pruning mode, or if you suspect the blocks on disk are actually corrupted. Otherwise, when you only suspect corruption of the chainstate (which is far more likely), use -reindex-chainstate.

Pieter Wuille

Posted 2017-10-14T18:34:56.550

Reputation: 54 032

1Thank you for your answer, I am actually running the node on a headless server, so I do not see a progress bar. Is there a definitive way to know when the sync is complete? I am currently doing it by looking at the log and seeing when the time stamp of the blocks catches up to the present.amanusk 2017-10-19T06:07:19.790