@@ -2484,6 +2484,20 @@ static void ApproximateBestSubset(const std::vector<CInputCoin>& vValue, const C
2484
2484
}
2485
2485
}
2486
2486
2487
+ bool CWallet::OutputEligibleForSpending (const COutput& output, const int nConfMine, const int nConfTheirs, const uint64_t nMaxAncestors) const
2488
+ {
2489
+ if (!output.fSpendable )
2490
+ return false ;
2491
+
2492
+ if (output.nDepth < (output.tx ->IsFromMe (ISMINE_ALL) ? nConfMine : nConfTheirs))
2493
+ return false ;
2494
+
2495
+ if (!mempool.TransactionWithinChainLimit (output.tx ->GetHash (), nMaxAncestors))
2496
+ return false ;
2497
+
2498
+ return true ;
2499
+ }
2500
+
2487
2501
bool CWallet::SelectCoinsMinConf (const CAmount& nTargetValue, const int nConfMine, const int nConfTheirs, const uint64_t nMaxAncestors, std::vector<COutput> vCoins,
2488
2502
std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet) const
2489
2503
{
@@ -2499,20 +2513,10 @@ bool CWallet::SelectCoinsMinConf(const CAmount& nTargetValue, const int nConfMin
2499
2513
2500
2514
for (const COutput &output : vCoins)
2501
2515
{
2502
- if (!output.fSpendable )
2503
- continue ;
2504
-
2505
- const CWalletTx *pcoin = output.tx ;
2506
-
2507
- if (output.nDepth < (pcoin->IsFromMe (ISMINE_ALL) ? nConfMine : nConfTheirs))
2508
- continue ;
2509
-
2510
- if (!mempool.TransactionWithinChainLimit (pcoin->GetHash (), nMaxAncestors))
2516
+ if (!OutputEligibleForSpending (output, nConfMine, nConfTheirs, nMaxAncestors))
2511
2517
continue ;
2512
2518
2513
- int i = output.i ;
2514
-
2515
- CInputCoin coin = CInputCoin (pcoin, i);
2519
+ CInputCoin coin = CInputCoin (output.tx , output.i );
2516
2520
2517
2521
if (coin.txout .nValue == nTargetValue)
2518
2522
{
0 commit comments