![]() |
Bitcoin Core 31.1.0
P2P Digital Currency
|
#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.
Classes | |
| struct | NodeContext |
| struct | COutput |
| A UTXO under consideration for use in funding a new transaction. More... | |
| class | CWallet |
| A CWallet maintains a set of transactions and balances, and provides the ability to create new transactions. More... | |
| class | CWalletTx |
| A transaction with a bunch of additional info that only the owner cares about. More... | |
| struct | CoinEligibilityFilter |
| Parameters for filtering which OutputGroups we may use in coin selection. More... | |
| struct | CoinSelectionParams |
| Parameters for one iteration of Coin Selection. More... | |
| struct | OutputGroup |
| A group of UTXOs paid to the same output script. More... | |
| struct | TxStateInactive |
Functions | |
| 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) |
Variables | |
| static constexpr CAmount | CHANGE_LOWER |
| lower bound for randomly-chosen target change amount | |
|
static |
Definition at line 103 of file coin_selection.cpp.
|
static |
Definition at line 42 of file coin_selection.cpp.
| util::Result< SelectionResult > wallet::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.
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.
| [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 | ( | BnBExhaustion | ) |
| BENCHMARK | ( | CoinSelection | ) |
|
static |
Definition at line 125 of file coin_selection.cpp.
|
static |
Definition at line 59 of file coin_selection.cpp.
| std::unique_ptr< WalletDatabase > wallet::CreateMockableWalletDatabase | ( | MockableData | records = {} | ) |
|
static |
Definition at line 113 of file coin_selection.cpp.
| util::Result< SelectionResult > wallet::SelectCoinsBnB | ( | std::vector< OutputGroup > & | utxo_pool, |
| const CAmount & | selection_target, | ||
| const CAmount & | cost_of_change, | ||
| int | max_selection_weight ) |
|
staticconstexpr |
lower bound for randomly-chosen target change amount
Definition at line 23 of file coinselection.h.