Skip to content

Commit

Permalink
Compare COutPoints lexicographically
Browse files Browse the repository at this point in the history
  • Loading branch information
josibake committed May 6, 2024
1 parent 00ac1b9 commit e623d8a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <consensus/amount.h>
#include <script/script.h>
#include <serialize.h>
#include <streams.h>
#include <uint256.h>
#include <util/transaction_identifier.h> // IWYU pragma: export

Expand Down Expand Up @@ -43,7 +44,10 @@ class COutPoint

friend bool operator<(const COutPoint& a, const COutPoint& b)
{
return std::tie(a.hash, a.n) < std::tie(b.hash, b.n);
DataStream ser_a, ser_b;
ser_a << a;
ser_b << b;
return Span{ser_a} < Span{ser_b};
}

friend bool operator==(const COutPoint& a, const COutPoint& b)
Expand Down

0 comments on commit e623d8a

Please sign in to comment.