Skip to content

Commit

Permalink
Refactor ComputeAndSetWaste()
Browse files Browse the repository at this point in the history
  • Loading branch information
murchandamus committed Sep 13, 2023
1 parent f18f9ef commit 18ca5c6
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/wallet/coinselection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,8 @@ void SelectionResult::SetBumpFeeDiscount(const CAmount discount)

void SelectionResult::ComputeAndSetWaste(const CAmount min_viable_change, const CAmount change_cost, const CAmount change_fee)
{
const CAmount change = GetChange(min_viable_change, change_fee);

if (change > 0) {
m_waste = GetSelectionWaste(change_cost, m_target, m_use_effective);
} else {
m_waste = GetSelectionWaste(0, m_target, m_use_effective);
}
bool makes_change = (0 != GetChange(min_viable_change, change_fee));
m_waste = GetSelectionWaste(makes_change ? change_cost : 0, m_target, m_use_effective);
}

CAmount SelectionResult::GetWaste() const
Expand Down

0 comments on commit 18ca5c6

Please sign in to comment.