mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-11 04:12:36 -03:00
wallet: Replace Assume with Assert where needed in coinselection
This commit is contained in:
parent
bf66e258a8
commit
fa26c55644
1 changed files with 3 additions and 4 deletions
|
@ -390,8 +390,7 @@ void SelectionResult::ComputeAndSetWaste(CAmount change_cost)
|
||||||
|
|
||||||
CAmount SelectionResult::GetWaste() const
|
CAmount SelectionResult::GetWaste() const
|
||||||
{
|
{
|
||||||
Assume(m_waste != std::nullopt);
|
return *Assert(m_waste);
|
||||||
return *m_waste;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CAmount SelectionResult::GetSelectedValue() const
|
CAmount SelectionResult::GetSelectedValue() const
|
||||||
|
@ -425,8 +424,8 @@ std::vector<CInputCoin> SelectionResult::GetShuffledInputVector() const
|
||||||
|
|
||||||
bool SelectionResult::operator<(SelectionResult other) const
|
bool SelectionResult::operator<(SelectionResult other) const
|
||||||
{
|
{
|
||||||
Assume(m_waste != std::nullopt);
|
Assert(m_waste.has_value());
|
||||||
Assume(other.m_waste != std::nullopt);
|
Assert(other.m_waste.has_value());
|
||||||
// As this operator is only used in std::min_element, we want the result that has more inputs when waste are equal.
|
// As this operator is only used in std::min_element, we want the result that has more inputs when waste are equal.
|
||||||
return *m_waste < *other.m_waste || (*m_waste == *other.m_waste && m_selected_inputs.size() > other.m_selected_inputs.size());
|
return *m_waste < *other.m_waste || (*m_waste == *other.m_waste && m_selected_inputs.size() > other.m_selected_inputs.size());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue