#include <bench/bench.h>
#include <consensus/amount.h>
#include <interfaces/chain.h>
#include <node/context.h>
#include <outputtype.h>
#include <policy/feerate.h>
#include <policy/policy.h>
#include <primitives/transaction.h>
#include <random.h>
#include <sync.h>
#include <util/result.h>
#include <wallet/coinselection.h>
#include <wallet/spend.h>
#include <wallet/test/util.h>
#include <wallet/transaction.h>
#include <wallet/wallet.h>
#include <cassert>
#include <map>
#include <memory>
#include <set>
#include <utility>
#include <vector>
Go to the source code of this file.
|
| static void | addCoin (const CAmount &nValue, const CWallet &wallet, std::vector< std::unique_ptr< CWalletTx > > &wtxs) |
| static void | CoinSelection (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) |
| static void | BnBExhaustion (benchmark::Bench &bench) |
| | BENCHMARK (CoinSelection) |
| | BENCHMARK (BnBExhaustion) |
| 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) |
| util::Result< SelectionResult > | SelectCoinsBnB (std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change, int max_selection_weight) |
◆ add_coin()
◆ addCoin()
| void addCoin |
( |
const CAmount & | nValue, |
|
|
const CWallet & | wallet, |
|
|
std::vector< std::unique_ptr< CWalletTx > > & | wtxs ) |
|
static |
◆ AttemptSelection()
Attempt to find a valid input set that preserves privacy by not mixing OutputTypes.
ChooseSelectionResult() will be called on each OutputType individually and the best the solution (according to the waste metric) will be chosen. If a valid input cannot be found from any single OutputType, fallback to running ChooseSelectionResult() over all available coins.
- Parameters
-
| [in] | chain | The chain interface to get information on bump fees for unconfirmed UTXOs |
| [in] | nTargetValue | The target value |
| [in] | groups | The grouped outputs mapped by coin eligibility filters |
| [in] | coin_selection_params | Parameters for the coin selection |
| [in] | allow_mixed_output_types | Relax restriction that SelectionResults must be of the same OutputType returns If successful, a SelectionResult containing the input set If failed, returns (1) an empty error message if the target was not reached (general "Insufficient funds") or (2) a specific error message if there was something particularly wrong (e.g. a selection result that surpassed the tx max weight size). |
Definition at line 702 of file spend.cpp.
◆ BENCHMARK() [1/2]
◆ BENCHMARK() [2/2]
◆ BnBExhaustion()
◆ CoinSelection()
◆ CreateMockableWalletDatabase()
◆ make_hard_case()
◆ SelectCoinsBnB()
◆ CHANGE_LOWER
lower bound for randomly-chosen target change amount
Definition at line 23 of file coinselection.h.