Use const in COutPoint class

This commit is contained in:
Hennadii Stepanov 2018-11-29 10:35:13 +02:00
parent 60b20c869f
commit 6b82fc59eb
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

@ -21,7 +21,9 @@ public:
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;
@ -32,8 +34,8 @@ public:
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)
{