Skip to content

Commit

Permalink
Use const in COutPoint class
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Nov 30, 2018
1 parent 60b20c8 commit 6b82fc5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/primitives/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ class COutPoint
uint256 hash;
uint32_t n;

COutPoint(): n((uint32_t) -1) { }
static constexpr uint32_t NULL_INDEX = std::numeric_limits<uint32_t>::max();

COutPoint(): n(NULL_INDEX) { }
COutPoint(const uint256& hashIn, uint32_t nIn): hash(hashIn), n(nIn) { }

ADD_SERIALIZE_METHODS;
Expand All @@ -32,8 +34,8 @@ class COutPoint
READWRITE(n);
}

void SetNull() { hash.SetNull(); n = (uint32_t) -1; }
bool IsNull() const { return (hash.IsNull() && n == (uint32_t) -1); }
void SetNull() { hash.SetNull(); n = NULL_INDEX; }
bool IsNull() const { return (hash.IsNull() && n == NULL_INDEX); }

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

0 comments on commit 6b82fc5

Please sign in to comment.