aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2021-08-11 22:03:56 -0400
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-08-20 10:36:44 +0300
commitffc81e2048bc9d3887211174b58f798b981f8c64 (patch)
tree4bc6727d7cfc5b85e3756122b26cbe09a162c216 /src
parentce77b45a1f4c6ff5bb0a283ffdd0999e734c1fb0 (diff)
downloadbitcoin-ffc81e2048bc9d3887211174b58f798b981f8c64.tar.xz
wallet: Use GetSelectionAmount for target value calculations
For target value calculations, GetSelectionAmount should be used, not m_effective_value or m_value. Specifically, ApproximateBestSubset mistakenly uses m_value when calculating whether the target value has been met. This has been changed to use GetSelectionAmount. Github-Pull: bitcoin/bitcoin#22686 Rebased-From: 2de222c40198d3d528668d78cc52e2ce3fa96765
Diffstat (limited to 'src')
-rw-r--r--src/wallet/coinselection.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index 6d502e1df1..25b1ee07e4 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -195,7 +195,7 @@ static void ApproximateBestSubset(const std::vector<OutputGroup>& groups, const
//the selection random.
if (nPass == 0 ? insecure_rand.randbool() : !vfIncluded[i])
{
- nTotal += groups[i].m_value;
+ nTotal += groups[i].GetSelectionAmount();
vfIncluded[i] = true;
if (nTotal >= nTargetValue)
{
@@ -205,7 +205,7 @@ static void ApproximateBestSubset(const std::vector<OutputGroup>& groups, const
nBest = nTotal;
vfBest = vfIncluded;
}
- nTotal -= groups[i].m_value;
+ nTotal -= groups[i].GetSelectionAmount();
vfIncluded[i] = false;
}
}