src/wallet/wallet.cpp
/**
 * populate vCoins with vector of available COutputs.
 */
populate vCoins with vector of available COutputs.
populate vCoins with vector of available COutputs .
void CWallet::AvailableCoins(vector<COutput>& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase, AvailableCoinsType nCoinType) const
{
    vCoins.clear();
    {
        LOCK2(cs_main, cs_wallet);
        for (map<uint256, CWalletTx>::const_iterator it = mapWallet.begin(); it != mapWallet.end(); ++it)
        {
            const uint256& wtxid = it->first;
            const CWalletTx* pcoin = &(*it).second;
            if (!CheckFinalTx(*pcoin))
                continue;
            if (fOnlyConfirmed && !pcoin->IsTrusted())
                continue;
            if (pcoin->IsCoinBase() && !fIncludeCoinBase)
                continue;
            if (pcoin->IsCoinBase() && pcoin->GetBlocksToMaturity() > 0)
                continue;
            int nDepth = pcoin->GetDepthInMainChain();
            if (nDepth < 0)
                continue;
            for (unsigned int i = 0; i < pcoin->vout.size(); i++) {
                bool found = false;
                if (nCoinType == ONLY_10000) {
                    found = pcoin->vout[i].nValue == 10000 * COIN;
                } else if (nCoinType == ONLY_25000) {
                    found = pcoin->vout[i].nValue == 25000 * COIN;
                } else if (nCoinType == ONLY_100000) {
                    found = pcoin->vout[i].nValue == 100000 * COIN;
                } else if (nCoinType == ALL_ZELNODE) {
                    if (pcoin->vout[i].nValue == 10000 * COIN) {
                        found = true;
                    }
                    else if (pcoin->vout[i].nValue == 25000 * COIN) {
                        found = true;
                    }
                    else if (pcoin->vout[i].nValue == 100000 * COIN) {
                        found = true;
                    }
                } else {
                    found = true;
                }
                if (!found) continue;
                isminetype mine = IsMine(pcoin->vout[i]);
                if (IsSpent(wtxid, i))
                    continue;
                if (mine == ISMINE_NO)
                    continue;
                if (IsLockedCoin((*it).first, i) && nCoinType != ONLY_10000 && nCoinType != ONLY_25000 && nCoinType != ONLY_100000 && nCoinType != ALL_ZELNODE )
                    continue;
                if (pcoin->vout[i].nValue <= 0 && !fIncludeZeroValue)
                    continue;
                if (coinControl && coinControl->HasSelected() && !coinControl->fAllowOtherInputs && !coinControl->IsSelected((*it).first, i))
                    continue;
                vCoins.emplace_back(COutput(pcoin, i, nDepth, (mine & ISMINE_SPENDABLE) != ISMINE_NO));
            }
        }
    }
}
void CWallet :: AvailableCoins ( vector < COutput > & vCoins , bool fOnlyConfirmed , const CCoinControl * coinControl , bool fIncludeZeroValue , bool fIncludeCoinBase , AvailableCoinsType nCoinType ) const { vCoins . clear ( ) ; { LOCK2 ( cs_main , cs_wallet ) ; for ( map < uint256 , CWalletTx > :: const_iterator it = mapWallet . begin ( ) ; it != mapWallet . end ( ) ; ++ it ) { const uint256 & wtxid = it -> first ; const CWalletTx * pcoin = & ( * it ) . second ; if ( ! CheckFinalTx ( * pcoin ) ) continue ; if ( fOnlyConfirmed && ! pcoin -> IsTrusted ( ) ) continue ; if ( pcoin -> IsCoinBase ( ) && ! fIncludeCoinBase ) continue ; if ( pcoin -> IsCoinBase ( ) && pcoin -> GetBlocksToMaturity ( ) > 0 ) continue ; int nDepth = pcoin -> GetDepthInMainChain ( ) ; if ( nDepth < 0 ) continue ; for ( unsigned int i = 0 ; i < pcoin -> vout . size ( ) ; i ++ ) { bool found = false ; if ( nCoinType == ONLY_10000 ) { found = pcoin -> vout [ i ] . nValue == 10000 * COIN ; } else if ( nCoinType == ONLY_25000 ) { found = pcoin -> vout [ i ] . nValue == 25000 * COIN ; } else if ( nCoinType == ONLY_100000 ) { found = pcoin -> vout [ i ] . nValue == 100000 * COIN ; } else if ( nCoinType == ALL_ZELNODE ) { if ( pcoin -> vout [ i ] . nValue == 10000 * COIN ) { found = true ; } else if ( pcoin -> vout [ i ] . nValue == 25000 * COIN ) { found = true ; } else if ( pcoin -> vout [ i ] . nValue == 100000 * COIN ) { found = true ; } } else { found = true ; } if ( ! found ) continue ; isminetype mine = IsMine ( pcoin -> vout [ i ] ) ; if ( IsSpent ( wtxid , i ) ) continue ; if ( mine == ISMINE_NO ) continue ; if ( IsLockedCoin ( ( * it ) . first , i ) && nCoinType != ONLY_10000 && nCoinType != ONLY_25000 && nCoinType != ONLY_100000 && nCoinType != ALL_ZELNODE ) continue ; if ( pcoin -> vout [ i ] . nValue <= 0 && ! fIncludeZeroValue ) continue ; if ( coinControl && coinControl -> HasSelected ( ) && ! coinControl -> fAllowOtherInputs && ! coinControl -> IsSelected ( ( * it ) . first , i ) ) continue ; vCoins . emplace_back ( COutput ( pcoin , i , nDepth , ( mine & ISMINE_SPENDABLE ) != ISMINE_NO ) ) ; } } } }
populate vCoins with vector of available COutputs.
populate vCoins with vector of available COutputs .
//            if (nCoinType != ALL_COINS) { //                if (nDepth < ZELNODE_MIN_CONFIRMATION_DETERMINISTIC) //                    continue; //            }