@@ -1852,9 +1852,9 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
1852
1852
nChangePosRet = -1 ;
1853
1853
bool fFirst = true ;
1854
1854
1855
- CAmount nTotalValue = nValue;
1855
+ CAmount nValueToSelect = nValue;
1856
1856
if (nSubtractFeeFromAmount == 0 )
1857
- nTotalValue += nFeeRet;
1857
+ nValueToSelect += nFeeRet;
1858
1858
double dPriority = 0 ;
1859
1859
// vouts to the payees
1860
1860
BOOST_FOREACH (const CRecipient& recipient, vecSend)
@@ -1891,7 +1891,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
1891
1891
// Choose coins to use
1892
1892
set<pair<const CWalletTx*,unsigned int > > setCoins;
1893
1893
CAmount nValueIn = 0 ;
1894
- if (!SelectCoins (nTotalValue , setCoins, nValueIn, coinControl))
1894
+ if (!SelectCoins (nValueToSelect , setCoins, nValueIn, coinControl))
1895
1895
{
1896
1896
strFailReason = _ (" Insufficient funds" );
1897
1897
return false ;
@@ -1909,10 +1909,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
1909
1909
dPriority += (double )nCredit * age;
1910
1910
}
1911
1911
1912
- CAmount nChange = nValueIn - nValue;
1913
- if (nSubtractFeeFromAmount == 0 )
1914
- nChange -= nFeeRet;
1915
-
1912
+ const CAmount nChange = nValueIn - nValueToSelect;
1916
1913
if (nChange > 0 )
1917
1914
{
1918
1915
// Fill a vout to ourself
0 commit comments