wallet::ChooseSelectionResult

Attempt to find a valid input set that meets the provided eligibility filter and target. Multiple coin selection algorithms will be run and the input set that produces the least waste (according to the waste metric) will be chosen.

Synopsis

Declared in <wallet/spend.h>

util::Result<SelectionResult>
ChooseSelectionResult(
    interfaces::Chain& chain,
    CAmount const& nTargetValue,
    Groups& groups,
    CoinSelectionParams const& coin_selection_params);

Return Value

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).

Parameters

NameDescription
chain [in]The chain interface to get information on bump fees for unconfirmed UTXOs
nTargetValue [in]The target value
groups [in]The struct containing the outputs grouped by script and divided by (1) positive only outputs and (2) all outputs (positive + negative).
coin_selection_params [in]Parameters for the coin selection