fix: reset chainman to allow reindex on failure (#5405)

current develop fails to reindex whenever there is an issue at node
start (prints `should not be overwriting a chainstate` in `debug.log`)

reset chainman to allow it re-initialize chainstate

simulated an issue with
```
 if (!fReset) {
     strLoadError = _("DEBUG");
     break;
 }
```

should not be any but pls test

- [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)_
This commit is contained in:
UdjinM6 2023-06-06 19:31:11 +03:00 committed by pasta
parent 013445a304
commit ad09590feb
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -2019,6 +2019,8 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
LOCK(cs_main);
node.evodb.reset();
node.evodb = std::make_unique<CEvoDB>(nEvoDbCache, false, fReset || fReindexChainState);
chainman.Reset();
chainman.InitializeChainstate(llmq::chainLocksHandler, llmq::quorumInstantSendManager, llmq::quorumBlockProcessor, node.evodb, *Assert(node.mempool));
chainman.m_total_coinstip_cache = nCoinCacheUsage;
chainman.m_total_coinsdb_cache = nCoinDBCache;