Skip to content

Commit 07e743e

Browse files
committed
Merge bitcoin#22892: doc: Clarify that change_cost cannot be negative in GetSelectionWaste
d2eccac doc: Clarify that change_cost cannot be negative in GetSelectionWaste (benthecarman) Pull request description: We assert that the `change_cost` must be positive so we should document it in the function's docs https://github.com/bitcoin/bitcoin/blob/4f5ad43b1e05cd7b403f87aae4c4d42e5aea810b/src/wallet/coinselection.cpp#L361 ACKs for top commit: jonatack: ACK d2eccac jarolrod: ACK d2eccac shaavan: ACK d2eccac Tree-SHA512: 089bc41d7e212b811455527ce2ac83301eae0edc03933dcbd5229b22078827395c8e3bcfda0ba029b7c60705db3119b4f80e372842a6bd8dae195dbaa0b52833
2 parents eabc2c4 + d2eccac commit 07e743e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/wallet/coinselection.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ struct OutputGroup
174174
* change_cost = effective_feerate * change_output_size + long_term_feerate * change_spend_size
175175
*
176176
* @param[in] inputs The selected inputs
177-
* @param[in] change_cost The cost of creating change and spending it in the future. Only used if there is change. Must be 0 if there is no change.
177+
* @param[in] change_cost The cost of creating change and spending it in the future.
178+
* Only used if there is change, in which case it must be positive.
179+
* Must be 0 if there is no change.
178180
* @param[in] target The amount targeted by the coin selection algorithm.
179181
* @param[in] use_effective_value Whether to use the input's effective value (when true) or the real value (when false).
180182
* @return The waste

0 commit comments

Comments
 (0)