[#wallet-SelectionResult-RecalculateWaste]
= xref:wallet.adoc[wallet]::xref:wallet/SelectionResult.adoc[SelectionResult]::RecalculateWaste
:relfileprefix: ../../
:mrdocs:

Calculates and stores the waste for this result given the cost of change and the opportunity cost of spending these inputs now vs in the future&period; If change exists, waste &equals; change&lowbar;cost &plus; inputs &ast; (effective&lowbar;feerate &hyphen; long&lowbar;term&lowbar;feerate) &hyphen; bump&lowbar;fee&lowbar;group&lowbar;discount If no change, waste &equals; excess &plus; inputs &ast; (effective&lowbar;feerate &hyphen; long&lowbar;term&lowbar;feerate) &hyphen; bump&lowbar;fee&lowbar;group&lowbar;discount where excess &equals; selected&lowbar;effective&lowbar;value &hyphen; target change&lowbar;cost &equals; effective&lowbar;feerate &ast; change&lowbar;output&lowbar;size &plus; long&lowbar;term&lowbar;feerate &ast; change&lowbar;spend&lowbar;size

== Synopsis

Declared in `&lt;wallet&sol;coinselection&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
void
RecalculateWaste(
    xref:CAmount.adoc[CAmount] min&lowbar;viable&lowbar;change,
    xref:CAmount.adoc[CAmount] change&lowbar;cost,
    xref:CAmount.adoc[CAmount] change&lowbar;fee);
----

== Parameters

[cols="1,4"]
|===
| Name| Description
| *min&lowbar;viable&lowbar;change* [in]
| The minimum amount necessary to make a change output economic
| *change&lowbar;cost* [in]
| The cost of creating a change output and spending it in the future&period; Only used if there is change, in which case it must be non&hyphen;negative&period;
| *change&lowbar;fee* [in]
| The fee for creating a change output
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
