|
|
@ -2449,7 +2449,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (txout.IsDust(dustRelayFee)) |
|
|
|
if (IsDust(txout, ::dustRelayFee)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (recipient.fSubtractFeeFromAmount && nFeeRet > 0) |
|
|
|
if (recipient.fSubtractFeeFromAmount && nFeeRet > 0) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2514,16 +2514,16 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT |
|
|
|
// We do not move dust-change to fees, because the sender would end up paying more than requested.
|
|
|
|
// We do not move dust-change to fees, because the sender would end up paying more than requested.
|
|
|
|
// This would be against the purpose of the all-inclusive feature.
|
|
|
|
// This would be against the purpose of the all-inclusive feature.
|
|
|
|
// So instead we raise the change and deduct from the recipient.
|
|
|
|
// So instead we raise the change and deduct from the recipient.
|
|
|
|
if (nSubtractFeeFromAmount > 0 && newTxOut.IsDust(dustRelayFee)) |
|
|
|
if (nSubtractFeeFromAmount > 0 && IsDust(newTxOut, ::dustRelayFee)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CAmount nDust = newTxOut.GetDustThreshold(dustRelayFee) - newTxOut.nValue; |
|
|
|
CAmount nDust = GetDustThreshold(newTxOut, ::dustRelayFee) - newTxOut.nValue; |
|
|
|
newTxOut.nValue += nDust; // raise change until no more dust
|
|
|
|
newTxOut.nValue += nDust; // raise change until no more dust
|
|
|
|
for (unsigned int i = 0; i < vecSend.size(); i++) // subtract from first recipient
|
|
|
|
for (unsigned int i = 0; i < vecSend.size(); i++) // subtract from first recipient
|
|
|
|
{ |
|
|
|
{ |
|
|
|
if (vecSend[i].fSubtractFeeFromAmount) |
|
|
|
if (vecSend[i].fSubtractFeeFromAmount) |
|
|
|
{ |
|
|
|
{ |
|
|
|
txNew.vout[i].nValue -= nDust; |
|
|
|
txNew.vout[i].nValue -= nDust; |
|
|
|
if (txNew.vout[i].IsDust(dustRelayFee)) |
|
|
|
if (IsDust(txNew.vout[i], ::dustRelayFee)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
strFailReason = _("The transaction amount is too small to send after the fee has been deducted"); |
|
|
|
strFailReason = _("The transaction amount is too small to send after the fee has been deducted"); |
|
|
|
return false; |
|
|
|
return false; |
|
|
@ -2535,7 +2535,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend, CWalletT |
|
|
|
|
|
|
|
|
|
|
|
// Never create dust outputs; if we would, just
|
|
|
|
// Never create dust outputs; if we would, just
|
|
|
|
// add the dust to the fee.
|
|
|
|
// add the dust to the fee.
|
|
|
|
if (newTxOut.IsDust(dustRelayFee)) |
|
|
|
if (IsDust(newTxOut, ::dustRelayFee)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
nChangePosInOut = -1; |
|
|
|
nChangePosInOut = -1; |
|
|
|
nFeeRet += nChange; |
|
|
|
nFeeRet += nChange; |
|
|
|