@@ -2673,87 +2673,6 @@ void AddWrappedSerialsInflation()
26732673 uiInterface.ShowProgress (" " , 100 );
26742674}
26752675
2676- void RecalculateZPIVMinted ()
2677- {
2678- CBlockIndex *pindex = chainActive[Params ().Zerocoin_StartHeight ()];
2679- const int chainHeight = chainActive.Height ();
2680- uiInterface.ShowProgress (_ (" Recalculating minted ZPIV..." ), 0 );
2681- while (true ) {
2682- // Log Message and feedback message every 1000 blocks
2683- if (pindex->nHeight % 1000 == 0 ) {
2684- LogPrintf (" %s : block %d...\n " , __func__, pindex->nHeight );
2685- int percent = std::max (1 , std::min (99 , (int )((double )(pindex->nHeight - Params ().Zerocoin_StartHeight ()) * 100 / (chainHeight - Params ().Zerocoin_StartHeight ()))));
2686- uiInterface.ShowProgress (_ (" Recalculating minted ZPIV..." ), percent);
2687- }
2688-
2689- // overwrite possibly wrong vMintsInBlock data
2690- CBlock block;
2691- assert (ReadBlockFromDisk (block, pindex));
2692-
2693- std::list<CZerocoinMint> listMints;
2694- BlockToZerocoinMintList (block, listMints, true );
2695-
2696- std::vector<libzerocoin::CoinDenomination> vDenomsBefore = pindex->vMintDenominationsInBlock ;
2697- pindex->vMintDenominationsInBlock .clear ();
2698- for (auto mint : listMints)
2699- pindex->vMintDenominationsInBlock .emplace_back (mint.GetDenomination ());
2700-
2701- if (pindex->nHeight < chainHeight)
2702- pindex = chainActive.Next (pindex);
2703- else
2704- break ;
2705- }
2706- uiInterface.ShowProgress (" " , 100 );
2707- }
2708-
2709- void RecalculateZPIVSpent ()
2710- {
2711- CBlockIndex* pindex = chainActive[Params ().Zerocoin_StartHeight ()];
2712- const int chainHeight = chainActive.Height ();
2713- uiInterface.ShowProgress (_ (" Recalculating spent ZPIV..." ), 0 );
2714- while (true ) {
2715- if (pindex->nHeight % 1000 == 0 ) {
2716- LogPrintf (" %s : block %d...\n " , __func__, pindex->nHeight );
2717- int percent = std::max (1 , std::min (99 , (int )((double )(pindex->nHeight - Params ().Zerocoin_StartHeight ()) * 100 / (chainHeight - Params ().Zerocoin_StartHeight ()))));
2718- uiInterface.ShowProgress (_ (" Recalculating spent ZPIV..." ), percent);
2719- }
2720-
2721- // Rewrite zPIV supply
2722- CBlock block;
2723- assert (ReadBlockFromDisk (block, pindex));
2724-
2725- std::list<libzerocoin::CoinDenomination> listDenomsSpent = ZerocoinSpendListFromBlock (block, true );
2726-
2727- // Reset the supply to previous block
2728- pindex->mapZerocoinSupply = pindex->pprev ->mapZerocoinSupply ;
2729-
2730- // Add mints to zPIV supply
2731- for (auto denom : libzerocoin::zerocoinDenomList) {
2732- long nDenomAdded = count (pindex->vMintDenominationsInBlock .begin (), pindex->vMintDenominationsInBlock .end (), denom);
2733- pindex->mapZerocoinSupply .at (denom) += nDenomAdded;
2734- }
2735-
2736- // Remove spends from zPIV supply
2737- for (auto denom : listDenomsSpent)
2738- pindex->mapZerocoinSupply .at (denom)--;
2739-
2740- // Add inflation from Wrapped Serials if block is Zerocoin_Block_EndFakeSerial()
2741- if (pindex->nHeight == Params ().Zerocoin_Block_EndFakeSerial () + 1 )
2742- for (auto denom : libzerocoin::zerocoinDenomList) {
2743- pindex->mapZerocoinSupply .at (denom) += GetWrapppedSerialInflation (denom);
2744- }
2745-
2746- // Rewrite money supply
2747- assert (pblocktree->WriteBlockIndex (CDiskBlockIndex (pindex)));
2748-
2749- if (pindex->nHeight < chainHeight)
2750- pindex = chainActive.Next (pindex);
2751- else
2752- break ;
2753- }
2754- uiInterface.ShowProgress (" " , 100 );
2755- }
2756-
27572676bool RecalculatePIVSupply (int nHeightStart)
27582677{
27592678 const int chainHeight = chainActive.Height ();
@@ -2846,12 +2765,10 @@ bool UpdateZPIVSupply(const CBlock& block, CBlockIndex* pindex, bool fJustCheck)
28462765
28472766 // Track zerocoin money supply
28482767 CAmount nAmountZerocoinSpent = 0 ;
2849- pindex->vMintDenominationsInBlock .clear ();
28502768 if (pindex->pprev ) {
28512769 std::set<uint256> setAddedToWallet;
28522770 for (auto & m : listMints) {
28532771 libzerocoin::CoinDenomination denom = m.GetDenomination ();
2854- pindex->vMintDenominationsInBlock .push_back (m.GetDenomination ());
28552772 pindex->mapZerocoinSupply .at (denom)++;
28562773
28572774 // Remove any of our own mints from the mintpool
@@ -3095,8 +3012,6 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
30953012
30963013 // A one-time event where money supply counts were off and recalculated on a certain block.
30973014 if (pindex->nHeight == Params ().Zerocoin_Block_RecalculateAccumulators () + 1 ) {
3098- RecalculateZPIVMinted ();
3099- RecalculateZPIVSpent ();
31003015 RecalculatePIVSupply (Params ().Zerocoin_StartHeight ());
31013016 }
31023017
0 commit comments