Bitcoin ABC 0.30.5
P2P Digital Currency
Macros | Typedefs | Functions | Variables
coinselector_tests.cpp File Reference
#include <chainparams.h>
#include <consensus/amount.h>
#include <node/context.h>
#include <primitives/transaction.h>
#include <random.h>
#include <wallet/coincontrol.h>
#include <wallet/coinselection.h>
#include <wallet/spend.h>
#include <wallet/wallet.h>
#include <test/util/setup_common.h>
#include <wallet/test/wallet_test_fixture.h>
#include <boost/test/unit_test.hpp>
#include <memory>
#include <random>
Include dependency graph for coinselector_tests.cpp:

Go to the source code of this file.

Macros

#define RUN_TESTS   100
 
#define RANDOM_REPEATS   5
 

Typedefs

typedef std::set< CInputCoinCoinSet
 

Functions

static void add_coin (const Amount nValue, int nInput, std::vector< CInputCoin > &set)
 
static void add_coin (const Amount nValue, int nInput, CoinSet &set)
 
static void add_coin (CWallet &wallet, const Amount nValue, int nAge=6 *24, bool fIsFromMe=false, int nInput=0, bool spendable=false)
 
static void empty_wallet ()
 
static bool equal_sets (CoinSet a, CoinSet b)
 
static Amount make_hard_case (int utxos, std::vector< CInputCoin > &utxo_pool)
 
std::vector< OutputGroup > & GroupCoins (const std::vector< CInputCoin > &coins)
 
std::vector< OutputGroup > & GroupCoins (const std::vector< COutput > &coins)
 
 BOOST_AUTO_TEST_CASE (bnb_search_test)
 
 BOOST_AUTO_TEST_CASE (knapsack_solver_test)
 
 BOOST_AUTO_TEST_CASE (ApproximateBestSubset)
 
 BOOST_AUTO_TEST_CASE (SelectCoins_test)
 

Variables

static std::vector< COutputvCoins
 
static node::NodeContext testNode
 
static Amount balance = Amount::zero()
 
CoinEligibilityFilter filter_standard (1, 6)
 
CoinEligibilityFilter filter_confirmed (1, 1)
 
CoinEligibilityFilter filter_standard_extra (6, 6)
 
CoinSelectionParams coin_selection_params (false, 0, 0, CFeeRate(Amount::zero()), 0, false)
 

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 27 of file coinselector_tests.cpp.

Typedef Documentation

◆ CoinSet

typedef std::set<CInputCoin> CoinSet

Definition at line 34 of file coinselector_tests.cpp.

Function Documentation

◆ add_coin() [1/3]

static void add_coin ( const Amount  nValue,
int  nInput,
CoinSet set 
)
static

Definition at line 54 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ add_coin() [2/3]

static void add_coin ( const Amount  nValue,
int  nInput,
std::vector< CInputCoin > &  set 
)
static

Definition at line 46 of file coinselector_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_coin() [3/3]

static void add_coin ( CWallet wallet,
const Amount  nValue,
int  nAge = 6 * 24,
bool  fIsFromMe = false,
int  nInput = 0,
bool  spendable = false 
)
static

Definition at line 61 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [1/4]

BOOST_AUTO_TEST_CASE ( ApproximateBestSubset  )

Definition at line 756 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [2/4]

BOOST_AUTO_TEST_CASE ( bnb_search_test  )

Definition at line 147 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [3/4]

BOOST_AUTO_TEST_CASE ( knapsack_solver_test  )

Definition at line 353 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ BOOST_AUTO_TEST_CASE() [4/4]

BOOST_AUTO_TEST_CASE ( SelectCoins_test  )

Definition at line 783 of file coinselector_tests.cpp.

Here is the call graph for this function:

◆ empty_wallet()

static void empty_wallet ( )
static

Definition at line 94 of file coinselector_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ equal_sets()

static bool equal_sets ( CoinSet  a,
CoinSet  b 
)
static

Definition at line 99 of file coinselector_tests.cpp.

Here is the caller graph for this function:

◆ GroupCoins() [1/2]

std::vector< OutputGroup > & GroupCoins ( const std::vector< CInputCoin > &  coins)
inline

Definition at line 119 of file coinselector_tests.cpp.

Here is the caller graph for this function:

◆ GroupCoins() [2/2]

std::vector< OutputGroup > & GroupCoins ( const std::vector< COutput > &  coins)
inline

Definition at line 129 of file coinselector_tests.cpp.

◆ make_hard_case()

static Amount make_hard_case ( int  utxos,
std::vector< CInputCoin > &  utxo_pool 
)
static

Definition at line 105 of file coinselector_tests.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ balance

Amount balance = Amount::zero()
static

Definition at line 38 of file coinselector_tests.cpp.

◆ coin_selection_params

CoinSelectionParams coin_selection_params(false, 0, 0, CFeeRate(Amount::zero()), 0, false) ( false  ,
,
,
CFeeRate(Amount::zero())  ,
,
false   
)

◆ filter_confirmed

CoinEligibilityFilter filter_confirmed(1, 1) ( ,
 
)

◆ filter_standard

CoinEligibilityFilter filter_standard(1, 6) ( ,
 
)

◆ filter_standard_extra

CoinEligibilityFilter filter_standard_extra(6, 6) ( ,
 
)

◆ testNode

node::NodeContext testNode
static

Definition at line 37 of file coinselector_tests.cpp.

◆ vCoins

std::vector<COutput> vCoins
static

Definition at line 36 of file coinselector_tests.cpp.