src/wallet.cpp
// PoSV: 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(const CAmount& nTargetValue, set<pair<const CWalletTx*,unsigned int> >& setCoinsRet, CAmount& nValueRet, unsigned int nSpendTime, int nMinConf) const
{
    vector<COutput> vCoins;
    AvailableCoinsMinConf(vCoins, nMinConf);
    setCoinsRet.clear();
    nValueRet = 0;
    BOOST_FOREACH(const COutput &output, vCoins)
    {
        if (!output.fSpendable)
        	continue;
    	const CWalletTx *pcoin = output.tx;
        int i = output.i;
        if (nValueRet >= nTargetValue)
            break;
        CAmount n = pcoin->vout[i].nValue;
        pair<CAmount,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 ( const CAmount & nTargetValue , set < pair < const CWalletTx * , unsigned int > > & setCoinsRet , CAmount & nValueRet , unsigned int nSpendTime , int nMinConf ) const { vector < COutput > vCoins ; AvailableCoinsMinConf ( vCoins , nMinConf ) ; setCoinsRet . clear ( ) ; nValueRet = 0 ; BOOST_FOREACH ( const COutput & output , vCoins ) { if ( ! output . fSpendable ) continue ; const CWalletTx * pcoin = output . tx ; int i = output . i ; if ( nValueRet >= nTargetValue ) break ; CAmount n = pcoin -> vout [ i ] . nValue ; pair < CAmount , 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 ; }
PoSV: Select some coins without random shuffle or best subset approximation
PoSV : 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