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 GitHub
parent 1a88a3c7d9
commit b9a738528c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -683,6 +683,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()) return true;

View File

@ -227,7 +227,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

@ -3532,8 +3532,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
@ -3811,6 +3809,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);
}
}