wallet::SelectCoins

Select all coins from coin_control, and if coin_control 'm_allow_other_inputs=true', call 'AutomaticCoinSelection' to select a set of coins such that nTargetValue - pre_set_inputs.total_amount is met.

Synopsis

Declared in <wallet/spend.h>

[[requires_capability(0x7f2e1e6570c8)]]
util::Result<SelectionResult>
SelectCoins(
    CWallet const& wallet,
    CoinsResult& available_coins,
    CoinsResult const& pre_set_inputs,
    CAmount const& nTargetValue,
    CCoinControl const& coin_control,
    CoinSelectionParams const& coin_selection_params);

Return Value

If successful, a SelectionResult containing the selected coins, otherwise an error.

Parameters

NameDescription
walletThe wallet which provides data necessary to spend the selected coins.
available_coinsThe coins, organized by OutputType, available for automatic selection.
pre_set_inputsInputs already chosen through coin control that must be included.
nTargetValueThe target value to be met by the selected coins.
coin_controlCoin control settings governing manual and automatic selection.
coin_selection_paramsParameters for this coin selection such as feerates and spend options.