diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp
index ae07319657f62..b5c29fc8814c5 100644
--- a/src/qt/coincontroldialog.cpp
+++ b/src/qt/coincontroldialog.cpp
@@ -433,7 +433,7 @@ void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
else {
coinControl->Select(outpt);
- int nRounds = pwalletMain->GetOutpointPrivateSendRounds(outpt);
+ int nRounds = pwalletMain->GetCappedOutpointPrivateSendRounds(outpt);
if (coinControl->fUsePrivateSend && nRounds < privateSendClient.nPrivateSendRounds) {
QMessageBox::warning(this, windowTitle(),
tr("Non-anonymized input selected. PrivateSend will be disabled.
If you still want to use PrivateSend, please deselect all non-nonymized inputs first and then check PrivateSend checkbox again."),
@@ -781,7 +781,7 @@ void CoinControlDialog::updateView()
// PrivateSend rounds
COutPoint outpoint = COutPoint(out.tx->tx->GetHash(), out.i);
- int nRounds = pwalletMain->GetOutpointPrivateSendRounds(outpoint);
+ int nRounds = pwalletMain->GetCappedOutpointPrivateSendRounds(outpoint);
if (nRounds >= 0 || fDebug) itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, QString::number(nRounds));
else itemOutput->setText(COLUMN_PRIVATESEND_ROUNDS, tr("n/a"));
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 96060030381a5..54daf6c4a4f68 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -2647,7 +2647,7 @@ UniValue listunspent(const JSONRPCRequest& request)
entry.push_back(Pair("confirmations", out.nDepth));
entry.push_back(Pair("spendable", out.fSpendable));
entry.push_back(Pair("solvable", out.fSolvable));
- entry.push_back(Pair("ps_rounds", pwalletMain->GetOutpointPrivateSendRounds(COutPoint(out.tx->GetHash(), out.i))));
+ entry.push_back(Pair("ps_rounds", pwalletMain->GetCappedOutpointPrivateSendRounds(COutPoint(out.tx->GetHash(), out.i))));
results.push_back(entry);
}
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index b2aa465b5396b..2260fc5da9c38 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -1506,10 +1506,10 @@ int CWallet::GetRealOutpointPrivateSendRounds(const COutPoint& outpoint, int nRo
}
// respect current settings
-int CWallet::GetOutpointPrivateSendRounds(const COutPoint& outpoint) const
+int CWallet::GetCappedOutpointPrivateSendRounds(const COutPoint& outpoint) const
{
LOCK(cs_wallet);
- int realPrivateSendRounds = GetRealOutpointPrivateSendRounds(outpoint, 0);
+ int realPrivateSendRounds = GetRealOutpointPrivateSendRounds(outpoint);
return realPrivateSendRounds > privateSendClient.nPrivateSendRounds ? privateSendClient.nPrivateSendRounds : realPrivateSendRounds;
}
@@ -2172,7 +2172,7 @@ CAmount CWalletTx::GetAnonymizedCredit(bool fUseCache) const
if(pwallet->IsSpent(hashTx, i) || !pwallet->IsDenominated(outpoint)) continue;
- const int nRounds = pwallet->GetOutpointPrivateSendRounds(outpoint);
+ const int nRounds = pwallet->GetCappedOutpointPrivateSendRounds(outpoint);
if(nRounds >= privateSendClient.nPrivateSendRounds){
nCredit += pwallet->GetCredit(txout, ISMINE_SPENDABLE);
if (!MoneyRange(nCredit))
@@ -2420,7 +2420,7 @@ float CWallet::GetAverageAnonymizedRounds() const
for (const auto& outpoint : setWalletUTXO) {
if(!IsDenominated(outpoint)) continue;
- nTotal += GetOutpointPrivateSendRounds(outpoint);
+ nTotal += GetCappedOutpointPrivateSendRounds(outpoint);
nCount++;
}
@@ -2444,7 +2444,7 @@ CAmount CWallet::GetNormalizedAnonymizedBalance() const
if (!IsDenominated(outpoint)) continue;
if (it->second.GetDepthInMainChain() < 0) continue;
- int nRounds = GetOutpointPrivateSendRounds(outpoint);
+ int nRounds = GetCappedOutpointPrivateSendRounds(outpoint);
nTotal += it->second.tx->vout[outpoint.n].nValue * nRounds / privateSendClient.nPrivateSendRounds;
}
@@ -2844,7 +2844,7 @@ bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAm
if(nCoinType == ONLY_DENOMINATED) {
COutPoint outpoint = COutPoint(out.tx->GetHash(),out.i);
- int nRounds = GetOutpointPrivateSendRounds(outpoint);
+ int nRounds = GetCappedOutpointPrivateSendRounds(outpoint);
// make sure it's actually anonymized
if(nRounds < privateSendClient.nPrivateSendRounds) continue;
}
@@ -2867,7 +2867,7 @@ bool CWallet::SelectCoins(const std::vector& vAvailableCoins, const CAm
//make sure it's the denom we're looking for, round the amount up to smallest denom
if(out.tx->tx->vout[out.i].nValue == nDenom && nValueRet + nDenom < nTargetValue + nSmallestDenom) {
COutPoint outpoint = COutPoint(out.tx->GetHash(),out.i);
- int nRounds = GetOutpointPrivateSendRounds(outpoint);
+ int nRounds = GetCappedOutpointPrivateSendRounds(outpoint);
// make sure it's actually anonymized
if(nRounds < privateSendClient.nPrivateSendRounds) continue;
nValueRet += nDenom;
@@ -3028,7 +3028,7 @@ bool CWallet::SelectCoinsByDenominations(int nDenom, CAmount nValueMin, CAmount
CTxIn txin = CTxIn(out.tx->GetHash(), out.i);
- int nRounds = GetOutpointPrivateSendRounds(txin.prevout);
+ int nRounds = GetCappedOutpointPrivateSendRounds(txin.prevout);
if(nRounds >= nPrivateSendRoundsMax) continue;
if(nRounds < nPrivateSendRoundsMin) continue;
@@ -3112,7 +3112,7 @@ bool CWallet::SelectCoinsGrouppedByAddresses(std::vector& vecT
// otherwise they will just lead to higher fee / lower priority
if(wtx.tx->vout[i].nValue <= nSmallestDenom/10) continue;
// ignore anonymized
- if(GetOutpointPrivateSendRounds(COutPoint(outpoint.hash, i)) >= privateSendClient.nPrivateSendRounds) continue;
+ if(GetCappedOutpointPrivateSendRounds(COutPoint(outpoint.hash, i)) >= privateSendClient.nPrivateSendRounds) continue;
}
CompactTallyItem& item = mapTally[txdest];
@@ -3178,7 +3178,7 @@ bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<
if(nValueRet + out.tx->tx->vout[out.i].nValue <= nValueMax){
CTxIn txin = CTxIn(out.tx->GetHash(),out.i);
- int nRounds = GetOutpointPrivateSendRounds(txin.prevout);
+ int nRounds = GetCappedOutpointPrivateSendRounds(txin.prevout);
if(nRounds >= nPrivateSendRoundsMax) continue;
if(nRounds < nPrivateSendRoundsMin) continue;
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 65caff1f7867f..ee7b9376c1474 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -820,9 +820,9 @@ class CWallet : public CCryptoKeyStore, public CValidationInterface
int CountInputsWithAmount(CAmount nInputAmount);
// get the PrivateSend chain depth for a given input
- int GetRealOutpointPrivateSendRounds(const COutPoint& outpoint, int nRounds) const;
+ int GetRealOutpointPrivateSendRounds(const COutPoint& outpoint, int nRounds = 0) const;
// respect current settings
- int GetOutpointPrivateSendRounds(const COutPoint& outpoint) const;
+ int GetCappedOutpointPrivateSendRounds(const COutPoint& outpoint) const;
bool IsDenominated(const COutPoint& outpoint) const;