48 tx.
vout[0].nValue = nValue;
64 std::vector<std::unique_ptr<CWalletTx>> wtxs;
68 for (
int i = 0; i < 1000; ++i) {
75 for (
const auto& wtx : wtxs) {
76 const auto txout = wtx->tx->vout.at(0);
77 available_coins.
coins[
OutputType::BECH32].emplace_back(
COutPoint(wtx->GetHash(), 0), txout, 6 * 24,
CalculateMaximumSignedInputSize(txout, &
wallet,
nullptr),
true,
true,
true, wtx->GetTxTime(),
true, 0);
88 /*long_term_feerate=*/ CFeeRate(10'000),
103 static void add_coin(
const CAmount& nValue,
int nInput, std::vector<OutputGroup>&
set)
106 tx.
vout.resize(nInput + 1);
107 tx.
vout[nInput].nValue = nValue;
108 COutput output(
COutPoint(tx.
GetHash(), nInput), tx.
vout.at(nInput), 0, -1,
true,
true,
true, 0,
true, 0);
110 set.back().Insert(std::make_shared<COutput>(output), 0, 0);
117 for (
int i = 0; i < utxos; ++i) {
118 target +=
CAmount{1} << (utxos+i);
128 std::vector<OutputGroup> utxo_pool;
static constexpr CAmount CHANGE_LOWER
lower bound for randomly-chosen target change amount
State of transaction not confirmed or conflicting with a known block and not in the mempool...
std::map< OutputType, std::vector< COutput > > coins
int64_t CAmount
Amount in satoshis (Can be negative)
COutputs available for spending, stored by OutputType.
A transaction with a bunch of additional info that only the owner cares about.
NodeContext struct containing references to chain state and connection state.
Bench & run(char const *benchmarkName, Op &&op)
Repeatedly calls op() based on the configuration, and performs measurements.
int CalculateMaximumSignedInputSize(const CTxOut &txout, const COutPoint outpoint, const SigningProvider *provider, bool can_grind_r, const CCoinControl *coin_control)
static CAmount make_hard_case(int utxos, std::vector< OutputGroup > &utxo_pool)
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
A group of UTXOs paid to the same output script.
Txid GetHash() const
Compute the hash of this CMutableTransaction.
An outpoint - a combination of a transaction hash and an index n into its vout.
std::vector< CTxOut > vout
static void add_coin(const CAmount &nValue, int nInput, std::vector< OutputGroup > &set)
Parameters for one iteration of Coin Selection.
util::Result< SelectionResult > SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, int max_selection_weight)
static CTransactionRef MakeTransactionRef(Tx &&txIn)
util::Result< SelectionResult > AttemptSelection(interfaces::Chain &chain, const CAmount &nTargetValue, OutputGroupTypeMap &groups, const CoinSelectionParams &coin_selection_params, bool allow_mixed_output_types)
Attempt to find a valid input set that preserves privacy by not mixing OutputTypes.
static void addCoin(const CAmount &nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx >> &wtxs)
Parameters for filtering which OutputGroups we may use in coin selection.
static constexpr int32_t MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
static const CoinEligibilityFilter filter_standard(1, 6, 0)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
static void CoinSelection(benchmark::Bench &bench)
Fee rate in satoshis per kilovirtualbyte: CAmount / kvB.
A mutable version of CTransaction.
Main entry point to nanobench's benchmarking facility.
static void BnBExhaustion(benchmark::Bench &bench)
A UTXO under consideration for use in funding a new transaction.
FilteredOutputGroups GroupOutputs(const CWallet &wallet, const CoinsResult &coins, const CoinSelectionParams &coin_sel_params, const std::vector< SelectionFilter > &filters, std::vector< OutputGroup > &ret_discarded_groups)
BENCHMARK(CoinSelection, benchmark::PriorityLevel::HIGH)
static constexpr CAmount COIN
The amount of satoshis in one BTC.