File tree Expand file tree Collapse file tree 3 files changed +10
-7
lines changed
Expand file tree Collapse file tree 3 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 66#include " coins.h"
77
88#include " consensus/consensus.h"
9+ #include " invalid.h"
910#include " memusage.h"
1011#include " random.h"
1112
@@ -293,14 +294,16 @@ CAmount CCoinsViewCache::GetTotalAmount() const
293294 return nTotal;
294295}
295296
296- void CCoinsViewCache::PruneZerocoinMints ()
297+ void CCoinsViewCache::PruneInvalidEntries ()
297298{
299+ // Prune zerocoin Mints and fraudulent/frozen outputs
298300 std::unique_ptr<CCoinsViewCursor> pcursor (Cursor ());
299301 while (pcursor->Valid ()) {
300302 COutPoint key;
301303 Coin coin;
302- if (pcursor->GetKey (key) && pcursor->GetValue (coin) && coin.out .IsZerocoinMint ()) {
303- SpendCoin (key);
304+ if (pcursor->GetKey (key) && pcursor->GetValue (coin)) {
305+ if (coin.out .IsZerocoinMint () || invalid_out::ContainsOutPoint (key))
306+ SpendCoin (key);
304307 }
305308 pcursor->Next ();
306309 }
Original file line number Diff line number Diff line change @@ -296,9 +296,9 @@ class CCoinsViewCache : public CCoinsViewBacked
296296 CAmount GetTotalAmount () const ;
297297
298298 /*
299- * Prune zerocoin mints - do it once, after initialization
299+ * Prune zerocoin mints and frozen outputs - do it once, after initialization
300300 */
301- void PruneZerocoinMints ();
301+ void PruneInvalidEntries ();
302302
303303
304304private:
Original file line number Diff line number Diff line change @@ -1565,8 +1565,8 @@ bool AppInit2()
15651565 // Do it only once, when removing money supply (key 'M') from the DB. Can be skipped in future versions.
15661566 int64_t nDummySupply;
15671567 if (fZerocoinActive && pblocktree->Read (' M' , nDummySupply)) {
1568- LogPrintf (" Pruning zerocoin mints at height %d\n " , chainHeight);
1569- pcoinsTip->PruneZerocoinMints ();
1568+ LogPrintf (" Pruning zerocoin mints / invalid outs, at height %d\n " , chainHeight);
1569+ pcoinsTip->PruneInvalidEntries ();
15701570 pblocktree->Erase (' M' );
15711571 }
15721572
You can’t perform that action at this time.
0 commit comments