Post
Topic
Board Development & Technical Discussion
Re: Is the 21 million bitcoin limit unchangeable?
by
kjj
on 22/03/2013, 13:39:42 UTC
What I don't quite understand is the purpose for this line:

Code:
inline bool MoneyRange(int64 nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }

as a transaction will never even come close to that amount, and neither will any given Bitcoin address. Given the ~21 million COIN limit created by GetBlockValue, why is it necessary to check "nValue" to make sure it is within 0 - 21,000,000?

It is a quick check to allow rejecting a transaction without expensive processing.  Oh, and also, there was an overflow bug a long time ago.  I'd have to check the commit history to know if this was part of the fix for that or unrelated.

At any rate, a transaction outside that range is automatically invalid, so you can toss it out before relaying it or checking the signatures.