Skip to content

Commit 7d07e86

Browse files
committed
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.
1 parent edec7f7 commit 7d07e86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/wallet/coinselection.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ bool KnapsackSolver(const CAmount& nTargetValue, std::vector<OutputGroup>& group
302302
void OutputGroup::Insert(const CInputCoin& output, int depth, bool from_me, size_t ancestors, size_t descendants) {
303303
m_outputs.push_back(output);
304304
m_from_me &= from_me;
305-
m_value += output.effective_value;
305+
m_value += output.txout.nValue;
306306
m_depth = std::min(m_depth, depth);
307307
// ancestors here express the number of ancestors the new coin will end up having, which is
308308
// 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)
318318
auto it = m_outputs.begin();
319319
while (it != m_outputs.end() && it->outpoint != output.outpoint) ++it;
320320
if (it == m_outputs.end()) return it;
321-
m_value -= output.effective_value;
321+
m_value -= output.txout.nValue;
322322
effective_value -= output.effective_value;
323323
return m_outputs.erase(it);
324324
}

0 commit comments

Comments
 (0)