Skip to content

Commit

Permalink
Merge pull request #2889 from sqrrm/limit-bsq-offer
Browse files Browse the repository at this point in the history
Limit BSQ validator to 10M BSQ, fix #2727
  • Loading branch information
sqrrm authored Jun 18, 2019
2 parents abc0909 + ba002b5 commit cbab796
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ protected double getMinValue() {
@Inject
public BsqValidator(BsqFormatter bsqFormatter) {
this.bsqFormatter = bsqFormatter;
// TODO do we want a limit here?
//setMaxValue(bsqFormatter.parseToCoin("2500000"));
// Limit to avoid overflows
setMaxValue(bsqFormatter.parseToCoin("10000000"));
}

public void setMinValue(@NotNull Coin minValue) {
Expand All @@ -79,7 +79,11 @@ public ValidationResult validate(String input) {
if (result.isValid) {
result = validateIfNotZero(input)
.and(validateIfNotNegative(input))
.and(validateIfNotFractionalBtcValue(input))
.and(validateIfNotExceedsMaxValue(input));
}

if (result.isValid) {
result = validateIfNotFractionalBtcValue(input)
.and(validateIfNotExceedsMaxBtcValue(input))
.and(validateIfSufficientAvailableBalance(input))
.and(validateIfAboveDust(input))
Expand Down

0 comments on commit cbab796

Please sign in to comment.