Skip to content

Commit

Permalink
GUI: BitcoinAmountField: Limit issued assets to 21M
Browse files Browse the repository at this point in the history
MoneyRange at least seems to enforce 21M on assets, so do it here too
  • Loading branch information
luke-jr authored and instagibbs committed Apr 9, 2019
1 parent 2ebae1a commit af726c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/qt/bitcoinamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ class AmountSpinBox: public QAbstractSpinBox
}
val.second = val.second + steps * singleStep;
val.second = qMax(val.second, CAmount(0));
if (val.first == Params().GetConsensus().pegged_asset) {
// FIXME: Add this back in when assets can have > MAX_MONEY
// if (val.first == Params().GetConsensus().pegged_asset)
{
val.second = qMin(val.second, BitcoinUnits::maxMoney());
}
setValue(val);
Expand Down Expand Up @@ -198,7 +200,8 @@ class AmountSpinBox: public QAbstractSpinBox
bool valid = GUIUtil::parseAssetAmount(current_asset, text, currentUnit, &val);
if(valid)
{
if (val < 0 || (val > BitcoinUnits::maxMoney() && current_asset == Params().GetConsensus().pegged_asset)) {
// FIXME: Add this back in when assets can have > MAX_MONEY
if (val < 0 || (val > BitcoinUnits::maxMoney() /*&& current_asset == Params().GetConsensus().pegged_asset*/)) {
valid = false;
}
}
Expand Down

0 comments on commit af726c7

Please sign in to comment.