Move ::fCheckBlockIndex into ChainstateManager

This changes the flag for the bitcoin-chainstate executable. Previously
it was false, now it is the chain's default value (still false for the
main chain).
This commit is contained in:
MacroFake
2022-07-26 12:59:48 +02:00
parent fa43188d86
commit fa7c834b9f
6 changed files with 8 additions and 7 deletions

View File

@@ -121,7 +121,6 @@ GlobalMutex g_best_block_mutex;
std::condition_variable g_best_block_cv;
uint256 g_best_block;
bool g_parallel_script_checks{false};
bool fCheckBlockIndex = false;
const CBlockIndex* Chainstate::FindForkInGlobalIndex(const CBlockLocator& locator) const
{
@@ -4507,7 +4506,7 @@ void Chainstate::LoadExternalBlockFile(
void Chainstate::CheckBlockIndex()
{
if (!fCheckBlockIndex) {
if (!m_chainman.ShouldCheckBlockIndex()) {
return;
}
@@ -5248,6 +5247,7 @@ void ChainstateManager::ResetChainstates()
*/
static ChainstateManager::Options&& Flatten(ChainstateManager::Options&& opts)
{
if (!opts.check_block_index.has_value()) opts.check_block_index = opts.chainparams.DefaultConsistencyChecks();
if (!opts.minimum_chain_work.has_value()) opts.minimum_chain_work = UintToArith256(opts.chainparams.GetConsensus().nMinimumChainWork);
if (!opts.assumed_valid_block.has_value()) opts.assumed_valid_block = opts.chainparams.GetConsensus().defaultAssumeValid;
Assert(opts.adjusted_time_callback);