Changeset View
Changeset View
Standalone View
Standalone View
src/consensus/amount.h
- This file was moved from src/amount.h.
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Copyright (c) 2017-2019 The Bitcoin developers | // Copyright (c) 2017-2019 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AMOUNT_H | #ifndef BITCOIN_CONSENSUS_AMOUNT_H | ||||
#define BITCOIN_AMOUNT_H | #define BITCOIN_CONSENSUS_AMOUNT_H | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <cstdlib> | #include <cstdlib> | ||||
#include <ostream> | #include <ostream> | ||||
#include <string> | #include <string> | ||||
#include <type_traits> | #include <type_traits> | ||||
▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
* | * | ||||
* Note that this constant is *not* the total money supply, which in eCash | * Note that this constant is *not* the total money supply, which in eCash | ||||
* currently happens to be less than 21,000,000 COIN for various reasons, | * currently happens to be less than 21,000,000 COIN for various reasons, | ||||
* but rather a sanity check. As this sanity check is used by consensus-critical | * but rather a sanity check. As this sanity check is used by consensus-critical | ||||
* validation code, the exact value of the MAX_MONEY constant is consensus | * validation code, the exact value of the MAX_MONEY constant is consensus | ||||
* critical; in unusual circumstances like a(nother) overflow bug that allowed | * 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. | * for the creation of coins out of thin air modification could lead to a fork. | ||||
*/ | */ | ||||
static const Amount MAX_MONEY = 21000000 * COIN; | static constexpr Amount MAX_MONEY = 21000000 * COIN; | ||||
inline bool MoneyRange(const Amount nValue) { | inline bool MoneyRange(const Amount nValue) { | ||||
return nValue >= Amount::zero() && nValue <= MAX_MONEY; | return nValue >= Amount::zero() && nValue <= MAX_MONEY; | ||||
} | } | ||||
#endif // BITCOIN_AMOUNT_H | #endif // BITCOIN_CONSENSUS_AMOUNT_H |