Bitcoin Core  27.99.0
P2P Digital Currency
Namespaces | Macros | Typedefs | Functions | Variables
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/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

 wallet
 

Macros

#define RUN_TESTS   100
 
#define RANDOM_REPEATS   5
 

Typedefs

typedef std::set< std::shared_ptr< COutput > > wallet::CoinSet
 

Functions

static void wallet::add_coin (const CAmount &nValue, int nInput, std::vector< COutput > &set)
 
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< SelectionResult > wallet::KnapsackSolver (std::vector< OutputGroup > &groups, const CAmount &nTargetValue, CAmount change_target, FastRandomContext &rng)
 
std::optional< SelectionResult > wallet::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. More...
 
static bool wallet::EqualResult (const SelectionResult &a, const SelectionResult &b)
 Check if this selection is equal to another one. More...
 
static CAmount wallet::make_hard_case (int utxos, std::vector< COutput > &utxo_pool)
 
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< CWallet > wallet::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< SelectionResult > wallet::CoinGrinder (const CAmount &target, const CoinSelectionParams &cs_params, const node::NodeContext &m_node, int max_weight, std::function< CoinsResult(CWallet &)> coin_setup)
 
 wallet::BOOST_AUTO_TEST_CASE (coin_grinder_tests)
 
static util::Result< SelectionResult > wallet::SelectCoinsSRD (const CAmount &target, const CoinSelectionParams &cs_params, const node::NodeContext &m_node, int max_weight, std::function< CoinsResult(CWallet &)> coin_setup)
 
 wallet::BOOST_AUTO_TEST_CASE (srd_tests)
 
static util::Result< SelectionResult > wallet::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 CoinSet &set, CAmount amount)
 
 wallet::BOOST_AUTO_TEST_CASE (check_max_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 31 of file coinselector_tests.cpp.

◆ RUN_TESTS

#define RUN_TESTS   100

Definition at line 27 of file coinselector_tests.cpp.