Skip to content

Commit 4f1677b

Browse files
committed
Merge pull request #6198
0bb4385 Improve comment explaining purpose of MAX_MONEY constant (Peter Todd)
2 parents 3e8ccc7 + 0bb4385 commit 4f1677b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/amount.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ typedef int64_t CAmount;
1616
static const CAmount COIN = 100000000;
1717
static const CAmount CENT = 1000000;
1818

19-
/** No amount larger than this (in satoshi) is valid */
19+
/** No amount larger than this (in satoshi) is valid.
20+
*
21+
* Note that this constant is *not* the total money supply, which in Bitcoin
22+
* currently happens to be less than 21,000,000 BTC for various reasons, but
23+
* rather a sanity check. As this sanity check is used by consensus-critical
24+
* validation code, the exact value of the MAX_MONEY constant is consensus
25+
* critical; in unusual circumstances like a(nother) overflow bug that allowed
26+
* for the creation of coins out of thin air modification could lead to a fork.
27+
* */
2028
static const CAmount MAX_MONEY = 21000000 * COIN;
2129
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }
2230

0 commit comments

Comments
 (0)