diff options
Diffstat (limited to 'src/primitives/transaction.h')
-rw-r--r-- | src/primitives/transaction.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index fb9db508d2..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) { @@ -64,7 +66,7 @@ public: COutPoint prevout; CScript scriptSig; uint32_t nSequence; - CScriptWitness scriptWitness; //! Only serialized through CTransaction + CScriptWitness scriptWitness; //!< Only serialized through CTransaction /* Setting nSequence to this value for every input in a transaction * disables nLockTime. */ @@ -73,7 +75,7 @@ public: /* Below flags apply in the context of BIP 68*/ /* If this flag set, CTxIn::nSequence is NOT interpreted as a * relative lock-time. */ - static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1 << 31); + static const uint32_t SEQUENCE_LOCKTIME_DISABLE_FLAG = (1U << 31); /* If CTxIn::nSequence encodes a relative lock-time and this flag * is set, the relative lock-time has units of 512 seconds, |