mirror of
https://github.com/dashpay/dash.git
synced 2024-12-27 13:03:17 +01:00
parent
c40fccce9a
commit
4474de8573
@ -2947,6 +2947,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
}
|
}
|
||||||
|
|
||||||
const CAmount nChange = nValueIn - nValueToSelect;
|
const CAmount nChange = nValueIn - nValueToSelect;
|
||||||
|
CTxOut newTxOut;
|
||||||
|
|
||||||
if (nChange > 0)
|
if (nChange > 0)
|
||||||
{
|
{
|
||||||
@ -2987,7 +2988,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
scriptChange = GetScriptForDestination(vchPubKey.GetID());
|
scriptChange = GetScriptForDestination(vchPubKey.GetID());
|
||||||
}
|
}
|
||||||
|
|
||||||
CTxOut newTxOut(nChange, scriptChange);
|
newTxOut = CTxOut(nChange, scriptChange);
|
||||||
|
|
||||||
// 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.
|
||||||
@ -3045,6 +3046,20 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
|
|||||||
sort(txNew.vin.begin(), txNew.vin.end());
|
sort(txNew.vin.begin(), txNew.vin.end());
|
||||||
sort(txNew.vout.begin(), txNew.vout.end());
|
sort(txNew.vout.begin(), txNew.vout.end());
|
||||||
|
|
||||||
|
// If there was change output added before, we must update its position now
|
||||||
|
if (nChangePosRet != -1) {
|
||||||
|
int i = 0;
|
||||||
|
BOOST_FOREACH(const CTxOut& txOut, txNew.vout)
|
||||||
|
{
|
||||||
|
if (txOut == newTxOut)
|
||||||
|
{
|
||||||
|
nChangePosRet = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sign
|
// Sign
|
||||||
int nIn = 0;
|
int nIn = 0;
|
||||||
CTransaction txNewConst(txNew);
|
CTransaction txNewConst(txNew);
|
||||||
|
Loading…
Reference in New Issue
Block a user