6#include <chainparams.h>
21 std::vector<std::unique_ptr<CWalletTx>> &wtxs) {
22 static int nextLockTime = 0;
27 tx.
vout[0].nValue = nValue;
45 wallet.SetupLegacyScriptPubKeyMan();
46 std::vector<std::unique_ptr<CWalletTx>> wtxs;
50 for (
int i = 0; i < 1000; ++i) {
56 std::vector<COutput> coins;
57 coins.reserve(wtxs.size());
58 for (
const auto &wtx : wtxs) {
59 coins.emplace_back(
wallet, *wtx, 0 , 6 * 24 ,
68 std::set<CInputCoin> setCoinsRet;
72 coins, setCoinsRet, nValueRet,
76 assert(setCoinsRet.size() == 2);
81std::vector<std::unique_ptr<CWalletTx>>
wtxn;
85 std::vector<OutputGroup> &set) {
87 tx.
vout.resize(nInput + 1);
88 tx.
vout[nInput].nValue = nValue;
92 COutput(
wallet, *wtx, nInput, 0,
true,
true,
true).GetInputCoin(), 0,
94 wtxn.emplace_back(std::move(wtx));
99 std::vector<OutputGroup> &utxo_pool) {
102 for (
int i = 0; i < utxos; ++i) {
107 2 * i + 1, utxo_pool);
122 wallet.SetupLegacyScriptPubKeyMan();
123 std::vector<OutputGroup> utxo_pool;
static constexpr Amount SATOSHI
static constexpr Amount COIN
void SelectParams(const ChainType chain)
Sets the params returned by Params() to those for the given BIP70 chain name.
const CChainParams & Params()
Return the currently selected parameters.
Fee rate in satoshis per kilobyte: Amount / kB.
A mutable version of CTransaction.
std::vector< CTxOut > vout
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 void addCoin(const Amount nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx > > &wtxs)
static void add_coin(const CWallet &wallet, const Amount nValue, int nInput, std::vector< OutputGroup > &set)
static void BnBExhaustion(benchmark::Bench &bench)
std::vector< std::unique_ptr< CWalletTx > > wtxn
std::set< CInputCoin > CoinSet
static Amount make_hard_case(const CWallet &wallet, int utxos, std::vector< OutputGroup > &utxo_pool)
bool SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const Amount &target_value, const Amount &cost_of_change, std::set< CInputCoin > &out_set, Amount &value_ret, const Amount not_input_fees)
This is the Branch and Bound Coin Selection algorithm designed by Murch.
CoinSelectionParams coin_selection_params(false, 0, 0, CFeeRate(Amount::zero()), 0, false)
CoinEligibilityFilter filter_standard(1, 6)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node, const CChainParams ¶ms)
Return implementation of Chain interface.
static CTransactionRef MakeTransactionRef()
bool SelectCoinsMinConf(const CWallet &wallet, const Amount nTargetValue, const CoinEligibilityFilter &eligibility_filter, std::vector< COutput > coins, std::set< CInputCoin > &setCoinsRet, Amount &nValueRet, const CoinSelectionParams &coin_selection_params, bool &bnb_used)
Shuffle and select coins until nTargetValue is reached while avoiding small change; This method is st...
static constexpr Amount zero() noexcept
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.