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

Name

Description

groups

The output groups eligible for selection.

nTargetValue

The target value to select for.

change_target

The minimum change amount to target.

rng

The randomness source used during selection.

max_selection_weight

The maximum allowed weight for a valid selection.

Created with MrDocs