Skip to content

Commit

Permalink
[BUG] Flush the chainstate after pruning invalid entries.
Browse files Browse the repository at this point in the history
Fix an edge case where the 'M' key is removed from the blockTree DB but
the chainstate still contains the invalid entries, due to it not being
flushed after the update.
  • Loading branch information
random-zebra committed Jan 27, 2021
1 parent 8ac7333 commit 0b56001
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1628,6 +1628,11 @@ bool AppInitMain()
if (fZerocoinActive && pblocktree->Read('M', nDummySupply)) {
LogPrintf("Pruning zerocoin mints / invalid outs, at height %d\n", chainHeight);
pcoinsTip->PruneInvalidEntries();
if (!pcoinsTip->Flush()) {
strLoadError = _("System error while flushing the chainstate after pruning invalid entries. Possible corrupt database.");
break;
}
MoneySupply.Update(pcoinsTip->GetTotalAmount(), chainHeight);
pblocktree->Erase('M');
}
}
Expand Down

0 comments on commit 0b56001

Please sign in to comment.