From 2c57b6c8a333b419a0a69053114e71afbffe78cc Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Thu, 30 Nov 2023 14:28:12 +0300 Subject: [PATCH] fix: avoid a crash on -reindex-chainstate --- src/init.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index dc5d84741bf78..45dddfb3e2205 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -2112,6 +2112,10 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load()); } + if (args.GetArg("-checklevel", DEFAULT_CHECKLEVEL) >= 3) { + chainstate->ResetBlockFailureFlags(nullptr); + } + } else { // TODO: CEvoDB instance should probably be a part of CChainState // (for multiple chainstates to actually work in parallel) @@ -2123,10 +2127,6 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc break; } } - - if (args.GetArg("-checklevel", DEFAULT_CHECKLEVEL) >= 3) { - ::ChainstateActive().ResetBlockFailureFlags(nullptr); - } } } catch (const std::exception& e) { LogPrintf("%s\n", e.what());