Skip to content

Commit a8573c9

Browse files
UdjinM6ogabrielides
authored andcommitted
fix: avoid crashes on "corrupted db" reindex attempts (dashpay#5717)
## Issue being fixed or feature implemented Should fix crashes like ``` : Corrupted block database detected. Please restart with -reindex or -reindex-chainstate to recover. Assertion failure: assertion: globalInstance == nullptr file: mnhftx.cpp, line: 43 function: CMNHFManager 0#: (0x105ADA27C) stacktraces.cpp:629 - __assert_rtn 1#: (0x104945794) mnhftx.cpp:43 - CMNHFManager::CMNHFManager(CEvoDB&) 2#: (0x10499DA90) compressed_pair.h:40 - std::__1::__unique_if<CMNHFManager>::__unique_single std::__1::make_unique[abi:v15006]<CMNHFManager, CEvoDB&>(CEvoDB&) 3#: (0x10499753C) init.cpp:1915 - AppInitMain(std::__1::variant<std::__1::nullopt_t, std::__1::reference_wrapper<NodeContext>, std::__1::reference_wrapper<WalletContext>, std::__1::reference_wrapper<CTxMemPool>, std::__1::reference_wrapper<ChainstateManager>, std::__1::reference_wrapper<CBlockPolicyEstimator>, std::__1::reference_wrapper<LLMQContext>> const&, NodeContext&, interfaces::BlockAndHeaderTipInfo*) ``` ## What was done? ## How Has This Been Tested? ## Breaking Changes n/a ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_
1 parent 3d94103 commit a8573c9

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/init.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1912,6 +1912,7 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
19121912
LOCK(cs_main);
19131913
node.evodb.reset();
19141914
node.evodb = std::make_unique<CEvoDB>(nEvoDbCache, false, fReset || fReindexChainState);
1915+
node.mnhf_manager.reset();
19151916
node.mnhf_manager = std::make_unique<CMNHFManager>(*node.evodb);
19161917

19171918
chainman.Reset();

0 commit comments

Comments
 (0)