mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-23 04:29:22 +00:00
parse commas in xmr amounts to decimal
This commit is contained in:
parent
4217424c6e
commit
0294062312
2 changed files with 3 additions and 2 deletions
|
@ -34,6 +34,7 @@ import haveno.core.trade.messages.InitTradeRequest;
|
|||
import haveno.core.trade.messages.PaymentReceivedMessage;
|
||||
import haveno.core.trade.messages.PaymentSentMessage;
|
||||
import haveno.core.util.JsonUtil;
|
||||
import haveno.core.util.ParsingUtils;
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
|
@ -189,7 +190,7 @@ public class HavenoUtils {
|
|||
public static BigInteger parseXmr(String input) {
|
||||
if (input == null || input.length() == 0) return BigInteger.valueOf(0);
|
||||
try {
|
||||
return xmrToAtomicUnits(new BigDecimal(input).doubleValue());
|
||||
return xmrToAtomicUnits(new BigDecimal(ParsingUtils.parseNumberStringToDouble(input)).doubleValue());
|
||||
} catch (Exception e) {
|
||||
return BigInteger.valueOf(0);
|
||||
}
|
||||
|
|
|
@ -687,7 +687,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
|
|||
if (minAmount.get() != null)
|
||||
minAmountValidationResult.set(isXmrInputValid(minAmount.get()));
|
||||
} else if (amount.get() != null && xmrValidator.getMaxTradeLimit() != null && xmrValidator.getMaxTradeLimit().longValueExact() == OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT.longValueExact()) {
|
||||
if (Double.parseDouble(amount.get()) < HavenoUtils.atomicUnitsToXmr(Restrictions.getMinTradeAmount())) {
|
||||
if (ParsingUtils.parseNumberStringToDouble(amount.get()) < HavenoUtils.atomicUnitsToXmr(Restrictions.getMinTradeAmount())) {
|
||||
amountValidationResult.set(result);
|
||||
} else {
|
||||
amount.set(HavenoUtils.formatXmr(xmrValidator.getMaxTradeLimit()));
|
||||
|
|
Loading…
Reference in a new issue