assumevalid is not always applied when reindexing #31494

issue mzumsande openend this issue on December 13, 2024
  1. mzumsande commented at 6:07 pm on December 13, 2024: contributor

    assumevalid (which disables script verification and therefore speeds up IBD) is not always applied in the context of a -reindex:

    The assumevalid criteria are https://github.com/bitcoin/bitcoin/blob/d73f37dda221835b5109ede1b84db2dc7c4b74a1/src/validation.cpp#L2497-L2500

    meaning that our best known header needs to have at least as much work than the hard-coded minchainwork. During normal IBD, we don’t connect blocks before having minchainwork headers (headers sync phase), so this is not a problem. However,-reindex deletes the block tree db and attempts to rebuild it based on local block files, without attempting to re-request headers for which we don’t have the full block yet (because we didn’t get to that point in the previous IBD).

    Therefore, users that encounter an error somewhere midway through IBD and need to reindex, won’t use -assumevalid and will rebuild the chainstate slowly. This has also been encountered in the context of benchmarking.

    Possible solutions:

    • always enable assumvalid while connecting blocks in the context of reindexing
    • attempt to sync remaining headers via the p2p nework after rebuilding the block tree db, but before calling ActivateBestChain() to start connecting blocks


mzumsande


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-21 12:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me