aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.cpp
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2019-11-07 17:19:24 -0500
committerAndrew Chow <achow101-github@achow101.com>2020-07-30 12:51:32 -0400
commit7d07e864b8846be186648814a5aaf34269f914a3 (patch)
treea846fb3b5eaac31327cc0ddb11d00065cbee9aed /src/wallet/coinselection.cpp
parentedec7f7c254294cd5c46ae5cf304353d458bb852 (diff)
Use real value when calculating OutputGroup value
OutputGroup::m_value is the true value, not the effective value, so use the true values of the outputs, not their effective values.
Diffstat (limited to 'src/wallet/coinselection.cpp')
-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 079a5d3d53..45b1add0a7 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -302,7 +302,7 @@ bool KnapsackSolver(const CAmount& nTargetValue, std::vector<OutputGroup>& group
void OutputGroup::Insert(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants) {
m_outputs.push_back(output);
m_from_me &= from_me;
- m_value += output.effective_value;
+ m_value += output.txout.nValue;
m_depth = std::min(m_depth, depth);
// ancestors here express the number of ancestors the new coin will end up having, which is
// the sum, rather than the max; this will overestimate in the cases where multiple inputs
@@ -318,7 +318,7 @@ std::vector<CInputCoin>::iterator OutputGroup::Discard(const CInputCoin& output)
auto it = m_outputs.begin();
while (it != m_outputs.end() && it->outpoint != output.outpoint) ++it;
if (it == m_outputs.end()) return it;
- m_value -= output.effective_value;
+ m_value -= output.txout.nValue;
effective_value -= output.effective_value;
return m_outputs.erase(it);
}