NeedsRedownload
exists to detect when a non-segwit client upgrades to segwit after segwit activation. In #21009, it was simplified from an upgrade algorithm to a simple check / recommendation to reindex.
Still, iterating over hundred thousands of block indexes with each startup for this purpose doesn’t seem necessary more than 7 years after segwit activation.
This PR suggests to only check the first segwit block instead. This is less thorough, but it will speed up init a little bit and the typical case of upgrading a non-segwit client that has already synced beyond the segwit height would still lead to an error.
I also thought about removing NeedsRedownload()
completely if reviewers prefer that alternative.