aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/coinselection.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-13 14:45:48 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-13 14:45:41 +0100
commitfa26c5564429d3201f43850afaf1b4df2ed11ad9 (patch)
tree595013a71b911c9572b35393efc0004cc6df5102 /src/wallet/coinselection.cpp
parentbf66e258a84e18935fde3ebb9a4b0392bf883222 (diff)
wallet: Replace Assume with Assert where needed in coinselection
Diffstat (limited to 'src/wallet/coinselection.cpp')
-rw-r--r--src/wallet/coinselection.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/wallet/coinselection.cpp b/src/wallet/coinselection.cpp
index ddf6a8b829..25874c601c 100644
--- a/src/wallet/coinselection.cpp
+++ b/src/wallet/coinselection.cpp
@@ -390,8 +390,7 @@ void SelectionResult::ComputeAndSetWaste(CAmount change_cost)
CAmount SelectionResult::GetWaste() const
{
- Assume(m_waste != std::nullopt);
- return *m_waste;
+ return *Assert(m_waste);
}
CAmount SelectionResult::GetSelectedValue() const
@@ -425,8 +424,8 @@ std::vector<CInputCoin> SelectionResult::GetShuffledInputVector() const
bool SelectionResult::operator<(SelectionResult other) const
{
- Assume(m_waste != std::nullopt);
- Assume(other.m_waste != std::nullopt);
+ Assert(m_waste.has_value());
+ 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.
return *m_waste < *other.m_waste || (*m_waste == *other.m_waste && m_selected_inputs.size() > other.m_selected_inputs.size());
}