diff options
author | vhf / victor felder <victorfelder@gmail.com> | 2013-05-22 01:19:18 +0300 |
---|---|---|
committer | Victor Felder <victorfelder@gmail.com> | 2013-06-02 14:44:55 +0200 |
commit | a35e268da44a1606af2fc18169f715e7eda8fb7c (patch) | |
tree | 161167fdfbc6ff50629166229ccf942448ff94b0 /src/qt/bitcoinunits.cpp | |
parent | 3702f127fdcd9dd6787112a05c11b80607367b39 (diff) |
Too many bitcoins allowed in amount. (#2401)
Using magic number doesn't seem right. Could we factor this out, together with https://github.com/bitcoin/bitcoin/blob/master/src/bitcoinrpc.cpp#L96 ?
And what about BitcoinUnits::parse() as well ?
Diffstat (limited to 'src/qt/bitcoinunits.cpp')
-rw-r--r-- | src/qt/bitcoinunits.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index d4715abaec..ae9791123d 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -63,6 +63,17 @@ qint64 BitcoinUnits::factor(int unit) } } +qint64 BitcoinUnits::maxAmount(int unit) +{ + switch(unit) + { + case BTC: return Q_INT64_C(21000000); + case mBTC: return Q_INT64_C(21000000000); + case uBTC: return Q_INT64_C(21000000000000); + default: return 0; + } +} + int BitcoinUnits::amountDigits(int unit) { switch(unit) |