mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-01 02:30:51 +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.
This commit is contained in:
parent
77e23ca945
commit
2de222c401
@ -195,7 +195,7 @@ static void ApproximateBestSubset(const std::vector<OutputGroup>& groups, const
|
|||||||
//the selection random.
|
//the selection random.
|
||||||
if (nPass == 0 ? insecure_rand.randbool() : !vfIncluded[i])
|
if (nPass == 0 ? insecure_rand.randbool() : !vfIncluded[i])
|
||||||
{
|
{
|
||||||
nTotal += groups[i].m_value;
|
nTotal += groups[i].GetSelectionAmount();
|
||||||
vfIncluded[i] = true;
|
vfIncluded[i] = true;
|
||||||
if (nTotal >= nTargetValue)
|
if (nTotal >= nTargetValue)
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ static void ApproximateBestSubset(const std::vector<OutputGroup>& groups, const
|
|||||||
nBest = nTotal;
|
nBest = nTotal;
|
||||||
vfBest = vfIncluded;
|
vfBest = vfIncluded;
|
||||||
}
|
}
|
||||||
nTotal -= groups[i].m_value;
|
nTotal -= groups[i].GetSelectionAmount();
|
||||||
vfIncluded[i] = false;
|
vfIncluded[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user