mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
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: 2de222c401
This commit is contained in:
parent
13a256fc9b
commit
efac8a33fa
1 changed files with 2 additions and 2 deletions
|
|
@ -212,7 +212,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)
|
||||
{
|
||||
|
|
@ -222,7 +222,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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue