Fix bug with dust warning

This commit is contained in:
Manfred Karrer 2016-02-07 10:47:29 +01:00
parent cff4db450c
commit 23f92db561

View file

@ -290,14 +290,15 @@ class TakeOfferDataModel extends ActivatableDataModel {
return true; return true;
} }
boolean isAmountLargerThanOfferAmountMinusFee() { boolean wouldCreateDustForOfferer() {
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (amountAsCoin.get() != null && offer != null) if (amountAsCoin.get() != null && offer != null) {
return amountAsCoin.get() Coin customAmount = offer.getAmount().subtract(amountAsCoin.get());
.add(FeePolicy.getFeePerKb()) Coin dustAndFee = FeePolicy.getFeePerKb().add(Transaction.MIN_NONDUST_OUTPUT);
.add(Transaction.MIN_NONDUST_OUTPUT) return customAmount.isPositive() && customAmount.isLessThan(dustAndFee);
.isGreaterThan(offer.getAmount()); } else {
return true; return true;
}
} }
public PaymentMethod getPaymentMethod() { public PaymentMethod getPaymentMethod() {