consensus: make COIN & MAX_MONEY constexpr

This commit is contained in:
fanquake 2021-09-11 11:41:46 +08:00
parent d09071da5b
commit 863e52fe63
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -11,7 +11,7 @@
/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;
static const CAmount COIN = 100000000;
static constexpr CAmount COIN = 100000000;
/** No amount larger than this (in satoshi) is valid.
*
@ -22,7 +22,7 @@ static const CAmount COIN = 100000000;
* critical; in unusual circumstances like a(nother) overflow bug that allowed
* for the creation of coins out of thin air modification could lead to a fork.
* */
static const CAmount MAX_MONEY = 21000000 * COIN;
static constexpr CAmount MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
#endif // BITCOIN_CONSENSUS_AMOUNT_H