Remove skipped denom from the list on tx commit (#2997)

* Remove skipped denom from the list on tx commit

Regardless of the tx type (PS or not).

* Update src/privatesend/privatesend-client.cpp

Co-Authored-By: Alexander Block <ablock84@gmail.com>
This commit is contained in:
UdjinM6 2019-06-26 14:39:36 +03:00 committed by Alexander Block
parent dff2c851d5
commit 2dc1b06ec7
3 changed files with 7 additions and 3 deletions

View File

@ -712,6 +712,11 @@ void CPrivateSendClientManager::AddSkippedDenom(const CAmount& nDenomValue)
vecDenominationsSkipped.push_back(nDenomValue);
}
void CPrivateSendClientManager::RemoveSkippedDenom(const CAmount& nDenomValue)
{
vecDenominationsSkipped.erase(std::remove(vecDenominationsSkipped.begin(), vecDenominationsSkipped.end(), nDenomValue), vecDenominationsSkipped.end());
}
bool CPrivateSendClientManager::WaitForAnotherBlock()
{
if (!masternodeSync.IsBlockchainSynced())

View File

@ -232,7 +232,7 @@ public:
bool IsDenomSkipped(const CAmount& nDenomValue);
void AddSkippedDenom(const CAmount& nDenomValue);
void ClearSkippedDenominations() { vecDenominationsSkipped.clear(); }
void RemoveSkippedDenom(const CAmount& nDenomValue);
void SetMinBlocksToWait(int nMinBlocksToWaitIn) { nMinBlocksToWait = nMinBlocksToWaitIn; }

View File

@ -3481,8 +3481,6 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT
if (nCoinType == ONLY_DENOMINATED) {
nFeeRet += nChange;
wtxNew.mapValue["DS"] = "1";
// recheck skipped denominations during next mixing
privateSendClient.ClearSkippedDenominations();
} else {
// Fill a vout to ourself
@ -3763,6 +3761,7 @@ bool CWallet::CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CCon
coin.BindWallet(this);
NotifyTransactionChanged(this, txin.prevout.hash, CT_UPDATED);
updated_hahes.insert(txin.prevout.hash);
privateSendClient.RemoveSkippedDenom(coin.tx->vout[txin.prevout.n].nValue);
}
}