src/wallet.cpp
bool CWallet::SelectCoinsSimple(int64 nTargetValue, unsigned int nSpendTime, int nMinConf, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const
{
    vector<COutput> vCoins;
    AvailableCoinsMinConf(vCoins, nMinConf);

    setCoinsRet.clear();
    nValueRet = 0;

    BOOST_FOREACH(COutput output, vCoins)
    {
        const CWalletTx *pcoin = output.tx;
        int i = output.i;

        // Stop if we've chosen enough inputs
        if (nValueRet >= nTargetValue)
            break;

        int64 n = pcoin->vout[i].nValue;

        pair<int64,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i));

        if (n >= nTargetValue)
        {
            // If input value is greater or equal to target then simply insert
            //    it into the current subset and exit
            setCoinsRet.insert(coin.second);
            nValueRet += coin.first;
            break;
        }
        else if (n < nTargetValue + CENT)
        {
            setCoinsRet.insert(coin.second);
            nValueRet += coin.first;
        }
    }

    return true;
}
// ppcoin: Select some coins without random shuffle or best subset approximation
Select some coins without random shuffle or best subset approximation
Select some coins without random shuffle or best subset approximation
bool CWallet::SelectCoinsSimple(int64 nTargetValue, unsigned int nSpendTime, int nMinConf, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, int64& nValueRet) const
{
    vector<COutput> vCoins;
    AvailableCoinsMinConf(vCoins, nMinConf);
    setCoinsRet.clear();
    nValueRet = 0;
    BOOST_FOREACH(COutput output, vCoins)
    {
        const CWalletTx *pcoin = output.tx;
        int i = output.i;
        if (nValueRet >= nTargetValue)
            break;
        int64 n = pcoin->vout[i].nValue;
        pair<int64,pair<const CWalletTx*,unsigned int> > coin = make_pair(n,make_pair(pcoin, i));
        if (n >= nTargetValue)
        {
            setCoinsRet.insert(coin.second);
            nValueRet += coin.first;
            break;
        }
        else if (n < nTargetValue + CENT)
        {
            setCoinsRet.insert(coin.second);
            nValueRet += coin.first;
        }
    }
    return true;
}
bool CWallet :: SelectCoinsSimple ( int64 nTargetValue , unsigned int nSpendTime , int nMinConf , set < pair < const CWalletTx * , unsigned int > > & setCoinsRet , int64 & nValueRet ) const { vector < COutput > vCoins ; AvailableCoinsMinConf ( vCoins , nMinConf ) ; setCoinsRet . clear ( ) ; nValueRet = 0 ; BOOST_FOREACH ( COutput output , vCoins ) { const CWalletTx * pcoin = output . tx ; int i = output . i ; if ( nValueRet >= nTargetValue ) break ; int64 n = pcoin -> vout [ i ] . nValue ; pair < int64 , pair < const CWalletTx * , unsigned int > > coin = make_pair ( n , make_pair ( pcoin , i ) ) ; if ( n >= nTargetValue ) { setCoinsRet . insert ( coin . second ) ; nValueRet += coin . first ; break ; } else if ( n < nTargetValue + CENT ) { setCoinsRet . insert ( coin . second ) ; nValueRet += coin . first ; } } return true ; }
ppcoin: Select some coins without random shuffle or best subset approximation
ppcoin : Select some coins without random shuffle or best subset approximation
// Stop if we've chosen enough inputs // If input value is greater or equal to target then simply insert //    it into the current subset and exit