mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Avoid pruning headers that have not been saved to disk yet
This commit is contained in:
parent
283f47b38d
commit
423715b048
3 changed files with 20 additions and 1 deletions
|
|
@ -2577,6 +2577,11 @@ bool CChainState::FlushStateToDisk(
|
|||
return AbortNode(state, "Failed to write to block index database");
|
||||
}
|
||||
|
||||
// This should be done inside WriteBatchSync, but CBlockIndex is const there
|
||||
for (std::set<CBlockIndex*>::iterator it = setTrimmableBlockIndex.begin(); it != setTrimmableBlockIndex.end(); it++) {
|
||||
(*it)->set_stored();
|
||||
}
|
||||
|
||||
if (node::fTrimHeaders) {
|
||||
LogPrintf("Flushing block index, trimming headers, setTrimmableBlockIndex.size(): %d\n", setTrimmableBlockIndex.size());
|
||||
int trim_height = m_chain.Height() - node::nMustKeepFullHeaders;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue