13 static void addCoin(
const CAmount& nValue,
const CWallet& wallet, std::vector<std::unique_ptr<CWalletTx>>& wtxs)
15 static int nextLockTime = 0;
19 tx.
vout[0].nValue = nValue;
36 std::vector<std::unique_ptr<CWalletTx>> wtxs;
37 LOCK(wallet.cs_wallet);
40 for (
int i = 0; i < 1000; ++i) {
46 std::vector<OutputGroup> groups;
47 for (
const auto& wtx : wtxs) {
48 COutput output(wtx.get(), 0 , 6 * 24 ,
true ,
true ,
true );
49 groups.emplace_back(output.GetInputCoin(), 6,
false, 0, 0);
58 std::set<CInputCoin> setCoinsRet;
61 bool success = wallet.SelectCoinsMinConf(1003 *
COIN, filter_standard, groups, setCoinsRet, nValueRet, coin_selection_params, bnb_used);
63 assert(nValueRet == 1003 *
COIN);
64 assert(setCoinsRet.size() == 2);
72 std::vector<std::unique_ptr<CWalletTx>>
wtxn;
75 static void add_coin(
const CAmount& nValue,
int nInput, std::vector<OutputGroup>& set)
78 tx.
vout.resize(nInput + 1);
79 tx.
vout[nInput].nValue = nValue;
81 set.emplace_back(
COutput(wtx.get(), nInput, 0,
true,
true,
true).GetInputCoin(), 0,
true, 0, 0);
82 wtxn.emplace_back(std::move(wtx));
89 for (
int i = 0; i < utxos; ++i) {
90 target += (
CAmount)1 << (utxos+i);
101 std::vector<OutputGroup> utxo_pool;
109 SelectCoinsBnB(utxo_pool, target, 0, selection, value_ret, not_input_fees);
void SetupLegacyScriptPubKeyMan()
Make a LegacyScriptPubKeyMan and set it for all types, internal, and external.
std::set< CInputCoin > CoinSet
static const CAmount COIN
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &target_value, const CAmount &cost_of_change, std::set< CInputCoin > &out_set, CAmount &value_ret, CAmount not_input_fees)
static CTransactionRef MakeTransactionRef()
CoinEligibilityFilter filter_standard(1, 6, 0)
std::vector< std::unique_ptr< CWalletTx > > wtxn
std::unique_ptr< Chain > MakeChain(NodeContext &node)
Return implementation of Chain interface.
int64_t CAmount
Amount in satoshis (Can be negative)
CoinSelectionParams coin_selection_params(false, 0, 0, CFeeRate(0), CFeeRate(0), CFeeRate(0), 0)
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
NodeContext struct containing references to chain state and connection state.
static CAmount make_hard_case(int utxos, std::vector< OutputGroup > &utxo_pool)
std::unique_ptr< WalletDatabase > CreateDummyWalletDatabase()
Return object for accessing dummy database with no read/write capabilities.
std::vector< CTxOut > vout
static void add_coin(const CAmount &nValue, int nInput, std::vector< OutputGroup > &set)
static void addCoin(const CAmount &nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx >> &wtxs)
static NodeContext testNode
static void CoinSelection(benchmark::Bench &bench)
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
Fee rate in satoshis per kilobyte: CAmount / kB.
A mutable version of CTransaction.
Main entry point to nanobench's benchmarking facility.
static void BnBExhaustion(benchmark::Bench &bench)
static CWallet testWallet(testChain.get(),"", CreateDummyWalletDatabase())