Select coins by Single Random Draw (SRD). SRD selects eligible OutputGroups from a shuffled ordering until the effective value of the input set suffices to create the recipient outputs and a change output with an amount of at least CHANGE_LOWER. While the maximum selection weight is exceeded during selection, the OutputGroup with the lowest effective value is dropped from the selection before additional OutputGroups are selected. Due to this greedy approach, SRD can fail to discover possible solutions in pathological cases.
Synopsis
Declared in <wallet/coinselection.h>
util::Result<SelectionResult>
SelectCoinsSRD(
std::vector<OutputGroup> const& utxo_pool,
CAmount target_value,
CAmount change_fee,
FastRandomContext& rng,
int max_selection_weight);
Return Value
If successful, a valid SelectionResult, otherwise, util::Error
Parameters
Name |
Description |
utxo_pool [in] |
The positive effective value OutputGroups eligible for selection |
target_value [in] |
The target value to select for |
change_fee [in] |
The cost of adding the change output to the transaction at the transaction’s feerate. |
rng [in] |
The randomness source to shuffle coins |
max_selection_weight [in] |
The maximum allowed weight for a selection result to be valid |
Created with MrDocs