@@ -2423,7 +2423,7 @@ CAmount CWallet::GetAvailableBalance(const CCoinControl* coinControl) const
2423
2423
return balance;
2424
2424
}
2425
2425
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
2427
2427
{
2428
2428
AssertLockHeld (cs_wallet);
2429
2429
@@ -2432,6 +2432,8 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2432
2432
// 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
2433
2433
// a coin control object is provided, and has the avoid address reuse flag set to false, do we allow already used addresses
2434
2434
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};
2435
2437
2436
2438
for (const auto & entry : mapWallet)
2437
2439
{
@@ -2491,8 +2493,9 @@ void CWallet::AvailableCoins(interfaces::Chain::Lock& locked_chain, std::vector<
2491
2493
continue ;
2492
2494
}
2493
2495
2494
- if (nDepth < nMinDepth || nDepth > nMaxDepth)
2496
+ if (nDepth < min_depth || nDepth > max_depth) {
2495
2497
continue ;
2498
+ }
2496
2499
2497
2500
for (unsigned int i = 0 ; i < wtx.tx ->vout .size (); i++) {
2498
2501
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
2934
2937
LOCK (cs_wallet);
2935
2938
{
2936
2939
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 );
2938
2941
CoinSelectionParams coin_selection_params; // Parameters for coin selection, init with dummy
2939
2942
2940
2943
// Create change script that will be used if we need change
0 commit comments