aboutsummaryrefslogtreecommitdiff
path: root/src/primitives
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-11-29 10:35:13 +0200
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2018-11-30 12:54:24 +0200
commit6b82fc59eb19004e54f910261a40d5e1b9e44b42 (patch)
tree693fc1b58854dfbe4cc0444f6f4e8cef601d2ea6 /src/primitives
parent60b20c869f8df9a81b5080ebcbe8c9cf4e6b9d77 (diff)
downloadbitcoin-6b82fc59eb19004e54f910261a40d5e1b9e44b42.tar.xz
Use const in COutPoint class
Diffstat (limited to 'src/primitives')
-rw-r--r--src/primitives/transaction.h8
1 files changed, 5 insertions, 3 deletions
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<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)
{