diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 6b990594dc15d..e9ad8a3597e99 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -4903,7 +4903,6 @@ bool CWallet::MintsToInputVectorPublicSpend(std::map& ma bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, CWalletTx& wtxNew, CReserveKey& reserveKey, CZerocoinSpendReceipt& receipt, vector& vSelectedMints, vector& vNewMints, bool fMintChange, bool fMinimizeChange, CBitcoinAddress* address) { - // Check available funds int nStatus = ZPIV_TRX_FUNDS_PROBLEMS; if (nValue > GetZerocoinBalance(true)) { @@ -4929,7 +4928,7 @@ bool CWallet::CreateZerocoinSpendTransaction(CAmount nValue, CWalletTx& wtxNew, vector vMintsToFetch; if (vSelectedMints.empty()) { // 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) - setMints = zpivTracker->ListMints(true, false, true); // need to find mints to spend + setMints = zpivTracker->ListMints(true, false, true, true); // need to find mints to spend if(setMints.empty()) { receipt.SetStatus(_("Failed to find Zerocoins in wallet.dat"), nStatus); return false; diff --git a/src/zpiv/zpivtracker.cpp b/src/zpiv/zpivtracker.cpp index 13fac4d656646..1d253523dc40c 100644 --- a/src/zpiv/zpivtracker.cpp +++ b/src/zpiv/zpivtracker.cpp @@ -460,7 +460,7 @@ bool CzPIVTracker::UpdateStatusInternal(const std::set& setMempool, CMi return false; } -std::set CzPIVTracker::ListMints(bool fUnusedOnly, bool fMatureOnly, bool fUpdateStatus, bool fWrongSeed) +std::set CzPIVTracker::ListMints(bool fUnusedOnly, bool fMatureOnly, bool fUpdateStatus, bool fWrongSeed, bool fExcludeV1) { CWalletDB walletdb(strWalletFile); if (fUpdateStatus) { @@ -473,6 +473,8 @@ std::set CzPIVTracker::ListMints(bool fUnusedOnly, bool fMatureOnly, CzPIVWallet* zPIVWallet = new CzPIVWallet(strWalletFile); for (auto& dMint : listDeterministicDB) { + if (fExcludeV1 && dMint.GetVersion() < 2) + continue; Add(dMint, false, false, zPIVWallet); } delete zPIVWallet; diff --git a/src/zpiv/zpivtracker.h b/src/zpiv/zpivtracker.h index 944c534f586df..7cce9909094eb 100644 --- a/src/zpiv/zpivtracker.h +++ b/src/zpiv/zpivtracker.h @@ -45,7 +45,7 @@ class CzPIVTracker bool ClearSpendCache() EXCLUSIVE_LOCKS_REQUIRED(cs_spendcache); std::vector GetMints(bool fConfirmedOnly) const; CAmount GetUnconfirmedBalance() const; - std::set ListMints(bool fUnusedOnly, bool fMatureOnly, bool fUpdateStatus, bool fWrongSeed = false); + std::set ListMints(bool fUnusedOnly, bool fMatureOnly, bool fUpdateStatus, bool fWrongSeed = false, bool fExcludeV1 = false); void RemovePending(const uint256& txid); void SetPubcoinUsed(const uint256& hashPubcoin, const uint256& txid); void SetPubcoinNotUsed(const uint256& hashPubcoin);