wallet::AttemptSelection

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.

Synopsis

Declared in <wallet/spend.h>

util::Result<SelectionResult>
AttemptSelection(
    interfaces::Chain& chain,
    CAmount const& nTargetValue,
    OutputGroupTypeMap& groups,
    CoinSelectionParams const& coin_selection_params,
    bool allow_mixed_output_types);

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 grouped outputs mapped by coin eligibility filters
coin_selection_params [in]Parameters for the coin selection
allow_mixed_output_types [in]Relax restriction that SelectionResults must be of the same OutputType