diff options
author | S3RK <1466284+S3RK@users.noreply.github.com> | 2022-08-15 09:30:31 +0200 |
---|---|---|
committer | S3RK <1466284+S3RK@users.noreply.github.com> | 2022-08-15 09:34:26 +0200 |
commit | c8cf08ea743e430c2bf3fe46439594257b0937e5 (patch) | |
tree | 81f06a202081dd8c4402d524b70ad359d8ac7af6 /src/wallet/coinselection.h | |
parent | dc9d6626835ec2864dfa747c12071dabdc95b919 (diff) |
wallet: ensure m_min_change_target always covers change fee
Diffstat (limited to 'src/wallet/coinselection.h')
-rw-r--r-- | src/wallet/coinselection.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/coinselection.h b/src/wallet/coinselection.h index e257d3f7c7..191476779f 100644 --- a/src/wallet/coinselection.h +++ b/src/wallet/coinselection.h @@ -252,6 +252,7 @@ struct OutputGroup /** Choose a random change target for each transaction to make it harder to fingerprint the Core * wallet based on the change output values of transactions it creates. + * Change target covers at least change fees and adds a random value on top of it. * The random value is between 50ksat and min(2 * payment_value, 1milsat) * When payment_value <= 25ksat, the value is just 50ksat. * @@ -261,8 +262,9 @@ struct OutputGroup * coins selected are just sufficient to cover the payment amount ("unnecessary input" heuristic). * * @param[in] payment_value Average payment value of the transaction output(s). + * @param[in] change_fee Fee for creating a change output. */ -[[nodiscard]] CAmount GenerateChangeTarget(CAmount payment_value, FastRandomContext& rng); +[[nodiscard]] CAmount GenerateChangeTarget(const CAmount payment_value, const CAmount change_fee, FastRandomContext& rng); enum class SelectionAlgorithm : uint8_t { |