Skip to content

Commit

Permalink
Merge #2166: [BUG] Flush the chainstate after pruning invalid entries.
Browse files Browse the repository at this point in the history
0b56001 [BUG] Flush the chainstate after pruning invalid entries. (random-zebra)

Pull request description:

  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.

ACKs for top commit:
  furszy:
    utACK 0b56001
  Fuzzbawls:
    utACK 0b56001

Tree-SHA512: ecd4285f3ea90ce7671e1e0978f8bfdfe34d6d135d74f9bb7161d061789b600509207e44cfe3ef7f1f41b7c905f2a429ef5e656c69f52d7719041038bb357130
  • Loading branch information
random-zebra committed Jan 30, 2021
2 parents 6143f80 + 0b56001 commit 263adf1
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 263adf1

Please sign in to comment.