mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 20:12:57 +01:00
e24fff7967
fa84723e73 amount: Move CAmount CENT to unit test header (MarcoFalke) Pull request description: `CAmount` is currently not type-safe. Exporting a constant (`CENT`) that is commonly not referred to by that name might be confusing. `CENT` is only used in two places prior to this commit (`ParseMoney` and `MIN_CHANGE`). So replace these with constants relative to `COIN` and move `CENT` to the unit test header. Tree-SHA512: 5273e96d8664ced6ae211abde2e20bc763e6e99f89404eec02c621f29e1d235e5f9b1ade933743843fae16fc24b643f883deda9221e3d9fd31229d2ab63a914f
29 lines
1.1 KiB
C
29 lines
1.1 KiB
C
// Copyright (c) 2009-2010 Satoshi Nakamoto
|
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
|
|
// Distributed under the MIT software license, see the accompanying
|
|
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#ifndef BITCOIN_AMOUNT_H
|
|
#define BITCOIN_AMOUNT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/** Amount in satoshis (Can be negative) */
|
|
typedef int64_t CAmount;
|
|
|
|
static const CAmount COIN = 100000000;
|
|
|
|
/** No amount larger than this (in satoshi) is valid.
|
|
*
|
|
* Note that this constant is *not* the total money supply, which in Bitcoin
|
|
* currently happens to be less than 21,000,000 BTC for various reasons, 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
|
|
* 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;
|
|
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
|
|
|
|
#endif // BITCOIN_AMOUNT_H
|