11 static void addCoin(
const CAmount& nValue,
const CWallet& wallet, std::vector<COutput>& vCoins)
15 static int nextLockTime = 0;
18 tx.
vout.resize(nInput + 1);
19 tx.
vout[nInput].nValue = nValue;
23 COutput output(wtx, nInput, nAge,
true ,
true ,
true );
24 vCoins.push_back(output);
37 std::vector<COutput> vCoins;
47 for (
int i = 0; i < 1000; i++)
48 addCoin(1000 * COIN, wallet, vCoins);
49 addCoin(3 * COIN, wallet, vCoins);
51 std::set<CInputCoin> setCoinsRet;
53 bool success = wallet.
SelectCoinsMinConf(1003 * COIN, 1, 6, 0, vCoins, setCoinsRet, nValueRet);
55 assert(nValueRet == 1003 * COIN);
56 assert(setCoinsRet.size() == 2);
bool SelectCoinsMinConf(const CAmount &nTargetValue, int nConfMine, int nConfTheirs, uint64_t nMaxAncestors, std::vector< COutput > vCoins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet) const
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
CCriticalSection cs_wallet
int64_t CAmount
Amount in corbies (Can be negative)
std::vector< CTxOut > vout
A transaction with a bunch of additional info that only the owner cares about.
A CWallet is an extension of a keystore, which also maintains a set of transactions and balances...
A mutable version of CTransaction.