wallet::KnapsackSolver

Select coins using the original Knapsack approximation, used as a fallback.

Synopsis

Declared in <wallet/coinselection.h>

util::Result<SelectionResult>
KnapsackSolver(
    std::vector<OutputGroup>& groups,
    CAmount const& nTargetValue,
    CAmount change_target,
    FastRandomContext& rng,
    int max_selection_weight);

Return Value

If successful, a valid SelectionResult, otherwise util::Error.

Parameters

NameDescription
groupsThe output groups eligible for selection.
nTargetValueThe target value to select for.
change_targetThe minimum change amount to target.
rngThe randomness source used during selection.
max_selection_weightThe maximum allowed weight for a valid selection.