@@ -1841,10 +1841,9 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
18411841 return true ;
18421842}
18431843
1844- bool CWallet::SelectCoins (const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int > >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl) const
1844+ bool CWallet::SelectCoins (const vector<COutput>& vAvailableCoins, const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int > >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl) const
18451845{
1846- vector<COutput> vCoins;
1847- AvailableCoins (vCoins, true , coinControl);
1846+ vector<COutput> vCoins (vAvailableCoins);
18481847
18491848 // coin control -> return all selected outputs (we want all selected to go into the transaction for sure)
18501849 if (coinControl && coinControl->HasSelected () && !coinControl->fAllowOtherInputs )
@@ -2010,6 +2009,9 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
20102009 {
20112010 LOCK2 (cs_main, cs_wallet);
20122011 {
2012+ std::vector<COutput> vAvailableCoins;
2013+ AvailableCoins (vAvailableCoins, true , coinControl);
2014+
20132015 nFeeRet = 0 ;
20142016 // Start with no fee and loop until there is enough fee
20152017 while (true )
@@ -2059,7 +2061,7 @@ bool CWallet::CreateTransaction(const vector<CRecipient>& vecSend, CWalletTx& wt
20592061 // Choose coins to use
20602062 set<pair<const CWalletTx*,unsigned int > > setCoins;
20612063 CAmount nValueIn = 0 ;
2062- if (!SelectCoins (nValueToSelect, setCoins, nValueIn, coinControl))
2064+ if (!SelectCoins (vAvailableCoins, nValueToSelect, setCoins, nValueIn, coinControl))
20632065 {
20642066 strFailReason = _ (" Insufficient funds" );
20652067 return false ;
0 commit comments