Skip to content

Commit fa26c55

Browse files
author
MarcoFalke
committed
wallet: Replace Assume with Assert where needed in coinselection
1 parent bf66e25 commit fa26c55

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/wallet/coinselection.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,7 @@ void SelectionResult::ComputeAndSetWaste(CAmount change_cost)
390390

391391
CAmount SelectionResult::GetWaste() const
392392
{
393-
Assume(m_waste != std::nullopt);
394-
return *m_waste;
393+
return *Assert(m_waste);
395394
}
396395

397396
CAmount SelectionResult::GetSelectedValue() const
@@ -425,8 +424,8 @@ std::vector<CInputCoin> SelectionResult::GetShuffledInputVector() const
425424

426425
bool SelectionResult::operator<(SelectionResult other) const
427426
{
428-
Assume(m_waste != std::nullopt);
429-
Assume(other.m_waste != std::nullopt);
427+
Assert(m_waste.has_value());
428+
Assert(other.m_waste.has_value());
430429
// As this operator is only used in std::min_element, we want the result that has more inputs when waste are equal.
431430
return *m_waste < *other.m_waste || (*m_waste == *other.m_waste && m_selected_inputs.size() > other.m_selected_inputs.size());
432431
}

0 commit comments

Comments
 (0)