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);
97 assert(result->GetSelectedValue() == 1003 *
COIN);
98 assert(result->GetInputSet().size() == 2);
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;
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 kilovirtualbyte: CAmount / kvB.
An outpoint - a combination of a transaction hash and an index n into its vout.
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.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
A transaction with a bunch of additional info that only the owner cares about.
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)
static void add_coin(const CAmount &nValue, int nInput, std::vector< OutputGroup > &set)
BENCHMARK(CoinSelection, benchmark::PriorityLevel::HIGH)
std::unique_ptr< Chain > MakeChain(node::NodeContext &node)
Return implementation of Chain interface.
static const CoinEligibilityFilter filter_standard(1, 6, 0)
FilteredOutputGroups GroupOutputs(const CWallet &wallet, const CoinsResult &coins, const CoinSelectionParams &coin_sel_params, const std::vector< SelectionFilter > &filters, std::vector< OutputGroup > &ret_discarded_groups)
static constexpr CAmount CHANGE_LOWER
lower bound for randomly-chosen target change amount
util::Result< SelectionResult > SelectCoinsBnB(std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, int max_selection_weight)
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.
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase(MockableData records)
int CalculateMaximumSignedInputSize(const CTxOut &txout, const COutPoint outpoint, const SigningProvider *provider, bool can_grind_r, const CCoinControl *coin_control)
static constexpr int32_t MAX_STANDARD_TX_WEIGHT
The maximum weight for transactions we're willing to relay/mine.
static CTransactionRef MakeTransactionRef(Tx &&txIn)
A mutable version of CTransaction.
std::vector< CTxOut > vout
Txid GetHash() const
Compute the hash of this CMutableTransaction.
NodeContext struct containing references to chain state and connection state.
A UTXO under consideration for use in funding a new transaction.
Parameters for filtering which OutputGroups we may use in coin selection.
Parameters for one iteration of Coin Selection.
COutputs available for spending, stored by OutputType.
std::map< OutputType, std::vector< COutput > > coins
A group of UTXOs paid to the same output script.
State of transaction not confirmed or conflicting with a known block and not in the mempool.