From ba002b5207339be28f14de14a9620ff6eb127664 Mon Sep 17 00:00:00 2001 From: sqrrm Date: Sun, 16 Jun 2019 14:49:37 +0200 Subject: [PATCH] Limit BSQ validator to 10M BSQ, fix #2727 --- .../bisq/desktop/util/validation/BsqValidator.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java index 5d913f26273..4749354771d 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java @@ -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) { @@ -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))