mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-15 12:51:00 +02:00
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.
This commit is contained in:
parent
edec7f7c25
commit
7d07e864b8
1 changed files with 2 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue