@@ -2311,18 +2311,10 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, int nConfMine, int
23112311 return true ;
23122312}
23132313
2314- bool CWallet::SelectCoinsToSpend (const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*, unsigned int > >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl, AvailableCoinsType coin_type, bool useIX, bool fIncludeColdStaking , bool fIncludeDelegated ) const
2314+ bool CWallet::SelectCoinsToSpend (const std::vector<COutput>& vAvailableCoins, const CAmount& nTargetValue, std::set<std::pair<const CWalletTx*, unsigned int > >& setCoinsRet, CAmount& nValueRet, const CCoinControl* coinControl) const
23152315{
23162316 // Note: this function should never be used for "always free" tx types like dstx
2317- std::vector<COutput> vCoins;
2318- AvailableCoins (&vCoins,
2319- coinControl,
2320- fIncludeDelegated ,
2321- fIncludeColdStaking ,
2322- coin_type,
2323- true , // fOnlyConfirmed
2324- false , // fIncludeZeroValue
2325- useIX);
2317+ std::vector<COutput> vCoins (vAvailableCoins);
23262318
23272319 // coin control -> return all selected outputs (we want all selected to go into the transaction for sure)
23282320 if (coinControl && coinControl->HasSelected () && !coinControl->fAllowOtherInputs ) {
@@ -2507,6 +2499,16 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend,
25072499 {
25082500 LOCK2 (cs_main, cs_wallet);
25092501 {
2502+ std::vector<COutput> vAvailableCoins;
2503+ AvailableCoins (&vAvailableCoins,
2504+ coinControl,
2505+ fIncludeDelegated ,
2506+ false , // fIncludeColdStaking
2507+ coin_type,
2508+ true , // fOnlyConfirmed
2509+ false , // fIncludeZeroValue
2510+ useIX);
2511+
25102512 nFeeRet = 0 ;
25112513 if (nFeePay > 0 ) nFeeRet = nFeePay;
25122514 while (true ) {
@@ -2552,7 +2554,7 @@ bool CWallet::CreateTransaction(const std::vector<CRecipient>& vecSend,
25522554 std::set<std::pair<const CWalletTx*, unsigned int > > setCoins;
25532555 CAmount nValueIn = 0 ;
25542556
2555- if (!SelectCoinsToSpend (nTotalValue, setCoins, nValueIn, coinControl, coin_type, useIX, false , fIncludeDelegated )) {
2557+ if (!SelectCoinsToSpend (vAvailableCoins, nTotalValue, setCoins, nValueIn, coinControl)) {
25562558 if (coin_type == ALL_COINS) {
25572559 strFailReason = _ (" Insufficient funds." );
25582560 }
0 commit comments