Skip to content

Commit c8d519e

Browse files
committed
[zPIV] zPIV Maturity --> Minimum amount of coins accumulated no needed anymore.
1 parent 0e8d0f9 commit c8d519e

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/wallet/wallet.cpp

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,20 +1660,25 @@ CAmount CWallet::GetBalance() const
16601660
return nTotal;
16611661
}
16621662

1663-
std::map<libzerocoin::CoinDenomination, int> mapMintMaturity;
1664-
int nLastMaturityCheck = 0;
1663+
//std::map<libzerocoin::CoinDenomination, int> mapMintMaturity;
1664+
//int nLastMaturityCheck = 0;
1665+
16651666
CAmount CWallet::GetZerocoinBalance(bool fMatureOnly) const
16661667
{
16671668
if (fMatureOnly) {
1668-
if (chainActive.Height() > nLastMaturityCheck)
1669-
mapMintMaturity = GetMintMaturityHeight();
1670-
nLastMaturityCheck = chainActive.Height();
1669+
// This code is not removed just for when we back to use zPIV in the future, for now it's useless,
1670+
// every public coin spend is now spendable without need to have new mints on top.
1671+
1672+
//if (chainActive.Height() > nLastMaturityCheck)
1673+
// mapMintMaturity = GetMintMaturityHeight();
1674+
//nLastMaturityCheck = chainActive.Height();
16711675

16721676
CAmount nBalance = 0;
16731677
vector<CMintMeta> vMints = zpivTracker->GetMints(true);
16741678
for (auto meta : vMints) {
1675-
if (meta.nHeight >= mapMintMaturity.at(meta.denom) || meta.nHeight >= chainActive.Height() || meta.nHeight == 0)
1676-
continue;
1679+
// Every public coin spend is now spendable, no need to mint new coins on top.
1680+
//if (meta.nHeight >= mapMintMaturity.at(meta.denom) || meta.nHeight >= chainActive.Height() || meta.nHeight == 0)
1681+
// continue;
16771682
nBalance += libzerocoin::ZerocoinDenominationToAmount(meta.denom);
16781683
}
16791684
return nBalance;
@@ -4922,7 +4927,8 @@ bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, CWalletTx& wtxNew,
49224927
const int nMaxSpends = Params().Zerocoin_MaxSpendsPerTransaction(); // Maximum possible spends for one zPIV transaction
49234928
vector<CMintMeta> vMintsToFetch;
49244929
if (vSelectedMints.empty()) {
4925-
setMints = zpivTracker->ListMints(true, true, true); // need to find mints to spend
4930+
// All of the zPIV used in the public coin spend are mature by default (everything is public now.. no need to wait for any accumulation)
4931+
setMints = zpivTracker->ListMints(true, false, true); // need to find mints to spend
49264932
if(setMints.empty()) {
49274933
receipt.SetStatus(_("Failed to find Zerocoins in wallet.dat"), nStatus);
49284934
return false;

0 commit comments

Comments
 (0)