Bitcoin Core 31.0.0
P2P Digital Currency
Loading...
Searching...
No Matches
coinselector_tests.cpp File Reference
#include <consensus/amount.h>
#include <node/context.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <random.h>
#include <test/util/common.h>
#include <test/util/setup_common.h>
#include <util/translation.h>
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
#include <wallet/spend.h>
#include <wallet/test/util.h>
#include <wallet/test/wallet_test_fixture.h>
#include <wallet/wallet.h>
#include <algorithm>
#include <boost/test/unit_test.hpp>
#include <random>
Include dependency graph for coinselector_tests.cpp:

Go to the source code of this file.

Namespaces

namespace  wallet

Macros

#define RUN_TESTS   100
#define RANDOM_REPEATS   5

Functions

static void wallet::add_coin (const CAmount &nValue, int nInput, SelectionResult &result)
static void wallet::add_coin (const CAmount &nValue, int nInput, SelectionResult &result, CAmount fee, CAmount long_term_fee)
static void wallet::add_coin (CoinsResult &available_coins, CWallet &wallet, const CAmount &nValue, CFeeRate feerate=CFeeRate(0), int nAge=6 *24, bool fIsFromMe=false, int nInput=0, bool spendable=false, int custom_size=0)
std::optional< SelectionResultwallet::KnapsackSolver (std::vector< OutputGroup > &groups, const CAmount &nTargetValue, CAmount change_target, FastRandomContext &rng)
std::optional< SelectionResultwallet::SelectCoinsBnB (std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change)
static bool wallet::EquivalentResult (const SelectionResult &a, const SelectionResult &b)
 Check if SelectionResult a is equivalent to SelectionResult b.
static bool wallet::EqualResult (const SelectionResult &a, const SelectionResult &b)
 Check if this selection is equal to another one.
std::vector< OutputGroup > & wallet::GroupCoins (const std::vector< COutput > &available_coins, bool subtract_fee_outputs=false)
std::vector< OutputGroup > & wallet::KnapsackGroupOutputs (const CoinsResult &available_coins, CWallet &wallet, const CoinEligibilityFilter &filter)
static std::unique_ptr< CWalletwallet::NewWallet (const node::NodeContext &m_node, const std::string &wallet_name="")
 wallet::BOOST_AUTO_TEST_CASE (bnb_search_test)
 wallet::BOOST_AUTO_TEST_CASE (bnb_sffo_restriction)
 wallet::BOOST_AUTO_TEST_CASE (knapsack_solver_test)
 wallet::BOOST_AUTO_TEST_CASE (ApproximateBestSubset)
 wallet::BOOST_AUTO_TEST_CASE (SelectCoins_test)
 wallet::BOOST_AUTO_TEST_CASE (waste_test)
 wallet::BOOST_AUTO_TEST_CASE (bump_fee_test)
 wallet::BOOST_AUTO_TEST_CASE (effective_value_test)
static util::Result< SelectionResultwallet::CoinGrinder (const CAmount &target, const CoinSelectionParams &cs_params, const node::NodeContext &m_node, int max_selection_weight, std::function< CoinsResult(CWallet &)> coin_setup)
 wallet::BOOST_AUTO_TEST_CASE (coin_grinder_tests)
static util::Result< SelectionResultwallet::SelectCoinsSRD (const CAmount &target, const CoinSelectionParams &cs_params, const node::NodeContext &m_node, int max_selection_weight, std::function< CoinsResult(CWallet &)> coin_setup)
 wallet::BOOST_AUTO_TEST_CASE (srd_tests)
static util::Result< SelectionResultwallet::select_coins (const CAmount &target, const CoinSelectionParams &cs_params, const CCoinControl &cc, std::function< CoinsResult(CWallet &)> coin_setup, const node::NodeContext &m_node)
static bool wallet::has_coin (const OutputSet &set, CAmount amount)
 wallet::BOOST_AUTO_TEST_CASE (check_max_selection_weight)
 wallet::BOOST_AUTO_TEST_CASE (SelectCoins_effective_value_test)
 wallet::BOOST_FIXTURE_TEST_CASE (wallet_coinsresult_test, BasicTestingSetup)

Variables

static const CoinEligibilityFilter wallet::filter_standard (1, 6, 0)
static const CoinEligibilityFilter wallet::filter_confirmed (1, 1, 0)
static const CoinEligibilityFilter wallet::filter_standard_extra (6, 6, 0)
static int wallet::nextLockTime = 0

Macro Definition Documentation

◆ RANDOM_REPEATS

#define RANDOM_REPEATS   5

Definition at line 32 of file coinselector_tests.cpp.

◆ RUN_TESTS

#define RUN_TESTS   100

Definition at line 28 of file coinselector_tests.cpp.