[#wallet-KnapsackSolver] = xref:wallet.adoc[wallet]::KnapsackSolver :relfileprefix: ../ :mrdocs: Select coins using the original Knapsack approximation, used as a fallback. == Synopsis Declared in `<wallet/coinselection.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- xref:util/Result.adoc[util::Result<SelectionResult>] KnapsackSolver( std::vector<OutputGroup>& groups, xref:CAmount.adoc[CAmount] const& nTargetValue, xref:CAmount.adoc[CAmount] change_target, xref:FastRandomContext.adoc[FastRandomContext]& rng, int max_selection_weight); ---- == Return Value If successful, a valid SelectionResult, otherwise util::Error. == Parameters [cols="1,4"] |=== | 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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#