38 tx.
vout[0].nValue = nValue;
51 const auto test_setup = MakeNoLogFileContext<TestingSetup>();
53 std::vector<std::unique_ptr<CWalletTx>> wtxs;
57 for (
int i = 0; i < 1000; ++i) {
64 for (
const auto& wtx : wtxs) {
65 const auto txout = wtx->tx->vout.at(0);
66 available_coins.
coins[
OutputType::BECH32].emplace_back(
COutPoint(wtx->GetHash(), 0), txout, 6 * 24,
CalculateMaximumSignedInputSize(txout, &
wallet,
nullptr),
true,
true, wtx->GetTxTime(),
true, 0);
86 assert(result->GetSelectedValue() == 1003 *
COIN);
87 assert(result->GetInputSet().size() == 2);
92static void add_coin(
const CAmount& nValue,
int nInput, std::vector<OutputGroup>& set)
95 tx.
vout.resize(nInput + 1);
96 tx.
vout[nInput].nValue = nValue;
99 set.back().Insert(std::make_shared<COutput>(output), 0, 0);
106 for (
int i = 0; i < utxos; ++i) {
107 target +=
CAmount{1} << (utxos+i);
116 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 virtualbyte: CAmount / vB the feerate is represented internally as FeeFrac.
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.
detail::SetupRunner< SetupOp > setup(SetupOp setupOp)
Configure an untimed setup step per epoch (fluent API).
Bench & epochIterations(uint64_t numIters) noexcept
Sets exactly the number of iterations for each epoch.
A CWallet maintains a set of transactions and balances, and provides the ability to create new transa...
void doNotOptimizeAway(Arg &&arg)
Makes sure none of the given arguments are optimized away by the compiler.
static const CoinEligibilityFilter filter_standard(1, 6, 0)
std::unique_ptr< WalletDatabase > CreateMockableWalletDatabase()
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)
static void addCoin(const CAmount &nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx > > &wtxs)
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 CoinSelection(benchmark::Bench &bench)
static void BnBExhaustion(benchmark::Bench &bench)
static void add_coin(const CAmount &nValue, int nInput, std::vector< OutputGroup > &set)
static CAmount make_hard_case(int utxos, std::vector< OutputGroup > &utxo_pool)
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.
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
State of transaction not confirmed or conflicting with a known block and not in the mempool.