aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-10-30 18:41:13 -0400
committerAndrew Chow <achow101-github@achow101.com>2021-05-19 13:33:31 -0400
commitbf26e018de33216d6f0ed0d6ff822b93536f7cc1 (patch)
tree1e6324db98a9734b40e8b2e15961758b3bd8cdf8 /src/wallet/coinselection.h
parentcc3f14b27c06b7a0da1472f5c7100c3f0b76fd98 (diff)
downloadbitcoin-bf26e018de33216d6f0ed0d6ff822b93536f7cc1.tar.xz
Roll static tx fees into nValueToSelect instead of having it be separate
The fees for transaction overhead and recipient outputs are now included in nTargetValue instead of being a separate parameter. For the coin selection algorithms, it doesn't matter that these are separate as in either case, the algorithm needs to select enough to cover these fees. Note that setting nValueToSelect is changed as it now includes not_input_fees. Without the change to how nValueToSelect is increased for KnapsackSolver, this would result in overpaying fees. The change to increase by the difference between nFeeRet and not_input_fees allows this to have the same behavior as previously. Additionally, because we assume that KnapsackSolver will always find a solution that requires change (we assume that BnB always finds a non-change solution), we also include the fee for the change output in KnapsackSolver's target. As part of this, we also use the changeless nFeeRet when iterating for KnapsackSolver. This is because we include the change fee when doing KnapsackSolver, so nFeeRet on further iterations won't include the change fee.
Diffstat (limited to 'src/wallet/coinselection.h')
-rw-r--r--src/wallet/coinselection.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h
index 5645e6db46..af23178d04 100644
--- a/src/wallet/coinselection.h
+++ b/src/wallet/coinselection.h
@@ -120,7 +120,7 @@ struct OutputGroup
bool EligibleForSpending(const CoinEligibilityFilter& eligibility_filter) const;
};
-bool SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool, const CAmount& target_value, const CAmount& cost_of_change, std::set<CInputCoin>& out_set, CAmount& value_ret, CAmount not_input_fees);
+bool SelectCoinsBnB(std::vector<OutputGroup>& utxo_pool, const CAmount& selection_target, const CAmount& cost_of_change, std::set<CInputCoin>& out_set, CAmount& value_ret);
// Original coin selection algorithm as a fallback
bool KnapsackSolver(const CAmount& nTargetValue, std::vector<OutputGroup>& groups, std::set<CInputCoin>& setCoinsRet, CAmount& nValueRet);