10 static void addCoin(
const CAmount& nValue,
const CWallet& wallet, std::vector<COutput>& vCoins)
14 static int nextLockTime = 0;
17 tx.
vout.resize(nInput + 1);
18 tx.
vout[nInput].nValue = nValue;
22 COutput output(wtx, nInput, nAge,
true ,
true ,
true );
23 vCoins.push_back(output);
36 std::vector<COutput> vCoins;
46 for (
int i = 0; i < 1000; i++)
47 addCoin(1000 * COIN, wallet, vCoins);
48 addCoin(3 * COIN, wallet, vCoins);
50 std::set<CInputCoin> setCoinsRet;
52 bool success = wallet.
SelectCoinsMinConf(1003 * COIN, 1, 6, 0, vCoins, setCoinsRet, nValueRet);
54 assert(nValueRet == 1003 * COIN);
55 assert(setCoinsRet.size() == 2);
CCriticalSection cs_wallet
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...
assert(len-trim+(2 *lenIndices)<=WIDTH)
int64_t CAmount
Amount in lius (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.
BENCHMARK(CoinSelection, 650)