mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
fix: avoid a crash on -reindex-chainstate (#5746)
## Issue being fixed or feature implemented Avoid a crash on -reindex-chainstate. ## What was done? `ResetBlockFailureFlags` is crashing when `m_chain.Tip()` is null. Call `ResetBlockFailureFlags` inside `if (!is_coinsview_empty(chainstate)) {...}` block - we know `m_chain.Tip()` is not null there. ## How Has This Been Tested? Try running a node with `-reindex-chainstate` cmd-line param w/ and w/out this patch. ## 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)_
This commit is contained in:
parent
5132c11cb0
commit
f8e88adadc
@ -2121,6 +2121,10 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
|
|||||||
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
|
LogPrintf("%s: bls_legacy_scheme=%d\n", __func__, bls::bls_legacy_scheme.load());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (args.GetArg("-checklevel", DEFAULT_CHECKLEVEL) >= 3) {
|
||||||
|
chainstate->ResetBlockFailureFlags(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// TODO: CEvoDB instance should probably be a part of CChainState
|
// TODO: CEvoDB instance should probably be a part of CChainState
|
||||||
// (for multiple chainstates to actually work in parallel)
|
// (for multiple chainstates to actually work in parallel)
|
||||||
@ -2132,10 +2136,6 @@ bool AppInitMain(const CoreContext& context, NodeContext& node, interfaces::Bloc
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.GetArg("-checklevel", DEFAULT_CHECKLEVEL) >= 3) {
|
|
||||||
::ChainstateActive().ResetBlockFailureFlags(nullptr);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
LogPrintf("%s\n", e.what());
|
LogPrintf("%s\n", e.what());
|
||||||
|
Loading…
Reference in New Issue
Block a user