aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHennadii Stepanov <[email protected]>2018-11-29 10:35:13 +0200
committerHennadii Stepanov <[email protected]>2018-11-30 12:54:24 +0200
commit6b82fc59eb19004e54f910261a40d5e1b9e44b42 (patch)
tree693fc1b58854dfbe4cc0444f6f4e8cef601d2ea6 /src
parentMerge #14822: bench: Destroy wallet txs instead of leaking their memory (diff)
downloaddiscoin-6b82fc59eb19004e54f910261a40d5e1b9e44b42.tar.xz
discoin-6b82fc59eb19004e54f910261a40d5e1b9e44b42.zip
Use const in COutPoint class
Diffstat (limited to 'src')
-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 0f834eb8c..c88d5b1ad 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)
{