Bitcoin Core  24.99.0
P2P Digital Currency
Namespaces | Functions | Variables
coinselection.cpp File Reference
#include <wallet/coinselection.h>
#include <consensus/amount.h>
#include <consensus/consensus.h>
#include <policy/feerate.h>
#include <util/check.h>
#include <util/system.h>
#include <util/moneystr.h>
#include <numeric>
#include <optional>
Include dependency graph for coinselection.cpp:

Go to the source code of this file.




std::optional< SelectionResult > wallet::SelectCoinsBnB (std::vector< OutputGroup > &utxo_pool, const CAmount &selection_target, const CAmount &cost_of_change)
std::optional< SelectionResult > wallet::SelectCoinsSRD (const std::vector< OutputGroup > &utxo_pool, CAmount target_value, FastRandomContext &rng)
 Select coins by Single Random Draw. More...
static void wallet::ApproximateBestSubset (FastRandomContext &insecure_rand, const std::vector< OutputGroup > &groups, const CAmount &nTotalLower, const CAmount &nTargetValue, std::vector< char > &vfBest, CAmount &nBest, int iterations=1000)
 Find a subset of the OutputGroups that is at least as large as, but as close as possible to, the target amount; solve subset sum. More...
std::optional< SelectionResult > wallet::KnapsackSolver (std::vector< OutputGroup > &groups, const CAmount &nTargetValue, CAmount change_target, FastRandomContext &rng)
CAmount wallet::GetSelectionWaste (const std::set< std::shared_ptr< COutput >> &inputs, CAmount change_cost, CAmount target, bool use_effective_value=true)
 Compute the waste for this result given the cost of change and the opportunity cost of spending these inputs now vs in the future. More...
CAmount wallet::GenerateChangeTarget (const CAmount payment_value, const CAmount change_fee, FastRandomContext &rng)
 Choose a random change target for each transaction to make it harder to fingerprint the Core wallet based on the change output values of transactions it creates. More...
std::string wallet::GetAlgorithmName (const SelectionAlgorithm algo)


struct {
static const size_t wallet::TOTAL_TRIES = 100000