Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/privatesend-client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ bool CPrivateSendClientSession::JoinExistingQueue(CAmount nBalanceNeedsAnonymize
CAmount nMaxAmount = nBalanceNeedsAnonymized;

// Try to match their denominations if possible, select exact number of denominations
if(!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nMinAmount, nMaxAmount, vecTxDSInTmp, vCoinsTmp, nValueInTmp, 0, privateSendClient.nPrivateSendRounds, true)) {
if(!pwalletMain->SelectCoinsByDenominations(dsq.nDenom, nMinAmount, nMaxAmount, vecTxDSInTmp, vCoinsTmp, nValueInTmp, 0, privateSendClient.nPrivateSendRounds - 1, true)) {
LogPrintf("CPrivateSendClientSession::JoinExistingQueue -- Couldn't match %d denominations %d (%s)\n", vecBits.front(), dsq.nDenom, CPrivateSend::GetDenominationsToString(dsq.nDenom));
continue;
}
Expand Down Expand Up @@ -1074,7 +1074,7 @@ bool CPrivateSendClientSession::StartNewQueue(CAmount nValueMin, CAmount nBalanc
// ** find the coins we'll use
std::vector<CTxIn> vecTxIn;
CAmount nValueInTmp = 0;
if(!pwalletMain->SelectCoinsDark(nValueMin, nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, privateSendClient.nPrivateSendRounds)) {
if(!pwalletMain->SelectCoinsDark(nValueMin, nBalanceNeedsAnonymized, vecTxIn, nValueInTmp, 0, privateSendClient.nPrivateSendRounds - 1)) {
// this should never happen
LogPrintf("CPrivateSendClientSession::StartNewQueue -- Can't mix: no compatible inputs found!\n");
strAutoDenomResult = _("Can't mix: no compatible inputs found!");
Expand Down Expand Up @@ -1190,15 +1190,15 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman)
if (fScanFromTheMiddle) {
nRoundStart = privateSendClient.nPrivateSendRounds / 2;
} else if (!fMixLowest) {
nRoundStart = privateSendClient.nPrivateSendRounds;
nRoundStart = privateSendClient.nPrivateSendRounds - 1;
}

// Submit transaction to the pool if we get here
if (fMixLowest) {
// Try to use only inputs with the same number of rounds, from low to high
while (true) {
for(int i = nRoundStart; i < privateSendClient.nPrivateSendRounds; i++) {
if(PrepareDenominate(i, i + 1, strError, vecTxDSInRet, vecTxOutRet)) {
if(PrepareDenominate(i, i, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i);
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
Expand All @@ -1211,7 +1211,7 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman)
// Try to use only inputs with the same number of rounds, from high to low
while (true) {
for(int i = nRoundStart; i > 0; i--) {
if(PrepareDenominate(i - 1, i, strError, vecTxDSInRet, vecTxOutRet)) {
if(PrepareDenominate(i, i, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for %d rounds, success\n", i);
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
Expand All @@ -1223,7 +1223,7 @@ bool CPrivateSendClientSession::SubmitDenominate(CConnman& connman)
}

// We failed? That's strange but let's just make final attempt and try to mix everything
if(PrepareDenominate(0, privateSendClient.nPrivateSendRounds, strError, vecTxDSInRet, vecTxOutRet)) {
if(PrepareDenominate(0, privateSendClient.nPrivateSendRounds - 1, strError, vecTxDSInRet, vecTxOutRet)) {
LogPrintf("CPrivateSendClientSession::SubmitDenominate -- Running PrivateSend denominate for all rounds, success\n");
return SendDenominate(vecTxDSInRet, vecTxOutRet, connman);
}
Expand Down
4 changes: 2 additions & 2 deletions src/wallet/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ bool CWallet::SelectCoinsByDenominations(int nDenom, CAmount nValueMin, CAmount
CTxIn txin = CTxIn(out.tx->GetHash(), out.i);

int nRounds = GetCappedOutpointPrivateSendRounds(txin.prevout);
if(nRounds >= nPrivateSendRoundsMax) continue;
if(nRounds > nPrivateSendRoundsMax) continue;
if(nRounds < nPrivateSendRoundsMin) continue;

for (const auto& nBit : vecBits) {
Expand Down Expand Up @@ -3199,7 +3199,7 @@ bool CWallet::SelectCoinsDark(CAmount nValueMin, CAmount nValueMax, std::vector<
CTxIn txin = CTxIn(out.tx->GetHash(),out.i);

int nRounds = GetCappedOutpointPrivateSendRounds(txin.prevout);
if(nRounds >= nPrivateSendRoundsMax) continue;
if(nRounds > nPrivateSendRoundsMax) continue;
if(nRounds < nPrivateSendRoundsMin) continue;

nValueRet += out.tx->tx->vout[out.i].nValue;
Expand Down