From 6b82fc59eb19004e54f910261a40d5e1b9e44b42 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Thu, 29 Nov 2018 10:35:13 +0200 Subject: Use const in COutPoint class --- src/primitives/transaction.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/primitives') diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 0f834eb8c1..c88d5b1ad3 100644 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -21,7 +21,9 @@ public: uint256 hash; uint32_t n; - COutPoint(): n((uint32_t) -1) { } + static constexpr uint32_t NULL_INDEX = std::numeric_limits::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) { -- cgit v1.2.3