Skip to content

Commit

Permalink
fix: reset chainman to allow reindex on failure (#5405)
Browse files Browse the repository at this point in the history
## Issue being fixed or feature implemented
current develop fails to reindex whenever there is an issue at node
start (prints `should not be overwriting a chainstate` in `debug.log`)

## What was done?
reset chainman to allow it re-initialize chainstate


## How Has This Been Tested?
simulated an issue with
```
 if (!fReset) {
     strLoadError = _("DEBUG");
     break;
 }
```


## Breaking Changes
should not be any but pls test


## 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)_
  • Loading branch information
UdjinM6 authored Jun 6, 2023
1 parent d49239c commit 87863a6
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,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;
Expand Down

0 comments on commit 87863a6

Please sign in to comment.