16 static int nextLockTime = 0;
20 tx.
vout[0].nValue = nValue;
36 std::vector<std::unique_ptr<CWalletTx>> wtxs;
40 for (
int i = 0; i < 1000; ++i) {
46 std::vector<COutput> coins;
47 for (
const auto& wtx : wtxs) {
48 coins.emplace_back(
wallet, *wtx, 0 , 6 * 24 ,
true ,
true ,
true );
57 std::set<CInputCoin> setCoinsRet;
62 assert(setCoinsRet.size() == 2);
69static void add_coin(
const CAmount& nValue,
int nInput, std::vector<OutputGroup>& set)
72 tx.
vout.resize(nInput + 1);
73 tx.
vout[nInput].nValue = nValue;
76 set.back().Insert(coin, 0,
true, 0, 0,
false);
83 for (
int i = 0; i < utxos; ++i) {
84 target += (
CAmount)1 << (utxos+i);
94 std::vector<OutputGroup> utxo_pool;
int64_t CAmount
Amount in satoshis (Can be negative)
static constexpr CAmount COIN
The amount of satoshis in one BTC.
Fee rate in satoshis per kilobyte: CAmount / kB.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Main entry point to nanobench's benchmarking facility.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
static void CoinSelection(benchmark::Bench &bench)
static CAmount make_hard_case(int utxos, std::vector< OutputGroup > &utxo_pool)
static void BnBExhaustion(benchmark::Bench &bench)
static void addCoin(const CAmount &nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx > > &wtxs)
std::set< CInputCoin > CoinSet
static void add_coin(const CAmount &nValue, int nInput, std::vector< OutputGroup > &set)
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, std::set< CInputCoin > &out_set, CAmount &value_ret)
static const CoinEligibilityFilter filter_standard(1, 6, 0)
std::unique_ptr< Chain > MakeChain(NodeContext &node)
Return implementation of Chain interface.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
bool AttemptSelection(const CWallet &wallet, const CAmount &nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, CAmount &nValueRet, const CoinSelectionParams &coin_selection_params)
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
A mutable version of CTransaction.
std::vector< CTxOut > vout
Parameters for filtering which OutputGroups we may use in coin selection.
Parameters for one iteration of Coin Selection.
NodeContext struct containing references to chain state and connection state.
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.