@@ -2423,7 +2423,7 @@ CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const
24232423 return balance;
24242424}
24252425
2426- void CWallet::AvailableCoins (interfaces::Chain::Lock& locked_chain, std::vector<COutput> & vCoins, bool fOnlySafe , const CCoinControl * coinControl, const CAmount & nMinimumAmount, const CAmount & nMaximumAmount, const CAmount & nMinimumSumAmount, const uint64_t nMaximumCount, const int nMinDepth, const int nMaxDepth ) const
2426+ void CWallet::AvailableCoins (interfaces::Chain::Lock& locked_chain, std::vector<COutput>& vCoins, bool fOnlySafe , const CCoinControl* coinControl, const CAmount& nMinimumAmount, const CAmount& nMaximumAmount, const CAmount& nMinimumSumAmount, const uint64_t nMaximumCount) const
24272427{
24282428 AssertLockHeld (cs_wallet);
24292429
@@ -2432,6 +2432,8 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
24322432 // Either the WALLET_FLAG_AVOID_REUSE flag is not set (in which case we always allow), or we default to avoiding, and only in the case where
24332433 // a coin control object is provided, and has the avoid address reuse flag set to false, do we allow already used addresses
24342434 bool allow_used_addresses = !IsWalletFlagSet (WALLET_FLAG_AVOID_REUSE) || (coinControl && !coinControl->m_avoid_address_reuse );
2435+ const int min_depth = {coinControl ? coinControl->m_min_depth : DEFAULT_MIN_DEPTH};
2436+ const int max_depth = {coinControl ? coinControl->m_max_depth : DEFAULT_MAX_DEPTH};
24352437
24362438 for (const auto & entry : mapWallet)
24372439 {
@@ -2491,8 +2493,9 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
24912493 continue ;
24922494 }
24932495
2494- if (nDepth < nMinDepth || nDepth > nMaxDepth)
2496+ if (nDepth < min_depth || nDepth > max_depth) {
24952497 continue ;
2498+ }
24962499
24972500 for (unsigned int i = 0 ; i < wtx.tx ->vout .size (); i++) {
24982501 if (wtx.tx ->vout [i].nValue < nMinimumAmount || wtx.tx ->vout [i].nValue > nMaximumAmount)
@@ -2934,7 +2937,7 @@ bool CWallet::CreateTransaction(interfaces::Chain::Lock& locked_chain, const std
29342937 LOCK (cs_wallet);
29352938 {
29362939 std::vector<COutput> vAvailableCoins;
2937- AvailableCoins (*locked_chain, vAvailableCoins, true , &coin_control, 1 , MAX_MONEY, MAX_MONEY, 0 , coin_control. m_min_depth );
2940+ AvailableCoins (*locked_chain, vAvailableCoins, true , &coin_control, 1 , MAX_MONEY, MAX_MONEY, 0 );
29382941 CoinSelectionParams coin_selection_params; // Parameters for coin selection, init with dummy
29392942
29402943 // Create change script that will be used if we need change
0 commit comments