Skip to content

Commit 049003f

Browse files
committed
coinselection: Remove COutput operators == and !=
These operators are used only by the tests in std::mismatch. As std::mismatch can take a binary predicate, we can use a lambda that achieves the same instead.
1 parent f6c39c6 commit 049003f

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/wallet/coinselection.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,6 @@ class COutput
8484
bool operator<(const COutput& rhs) const {
8585
return outpoint < rhs.outpoint;
8686
}
87-
88-
bool operator!=(const COutput& rhs) const {
89-
return outpoint != rhs.outpoint;
90-
}
91-
92-
bool operator==(const COutput& rhs) const {
93-
return outpoint == rhs.outpoint;
94-
}
9587
};
9688

9789
/** Parameters for one iteration of Coin Selection. */

src/wallet/test/coinselector_tests.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,10 @@ static bool EquivalentResult(const SelectionResult& a, const SelectionResult& b)
113113
/** Check if this selection is equal to another one. Equal means same inputs (i.e same value and prevout) */
114114
static bool EqualResult(const SelectionResult& a, const SelectionResult& b)
115115
{
116-
std::pair<CoinSet::iterator, CoinSet::iterator> ret = std::mismatch(a.GetInputSet().begin(), a.GetInputSet().end(), b.GetInputSet().begin());
116+
std::pair<CoinSet::iterator, CoinSet::iterator> ret = std::mismatch(a.GetInputSet().begin(), a.GetInputSet().end(), b.GetInputSet().begin(),
117+
[](const COutput& a, const COutput& b) {
118+
return a.outpoint == b.outpoint;
119+
});
117120
return ret.first == a.GetInputSet().end() && ret.second == b.GetInputSet().end();
118121
}
119122

0 commit comments

Comments
 (0)