Create order using the same tx fee specified at funding

This fixes an issue whereby updates from the fee API were causing
Insufficient Funds exception. Since the wallet is funded with a
specific amount (deposit+trade fee+txFee), that same amount has
to be used when the user confirms offer creation (which could be
some time later).

Fixes #4227
Fixes #4278
Fixes #4336
Fixes #4327
This commit is contained in:
jmacxx 2020-06-29 13:43:06 -05:00
parent a54eeeabcc
commit f3fa5ad3a1
No known key found for this signature in database
GPG Key ID: 155297BABFE94A1B
3 changed files with 6 additions and 1 deletions

View File

@ -123,12 +123,14 @@ public class CoreOffersService {
PaymentAccount paymentAccount,
boolean useSavingsWallet,
TransactionResultHandler resultHandler) {
Coin useDefaultTxFee = Coin.ZERO;
Offer offer = createOfferService.createAndGetOffer(offerId,
direction,
currencyCode,
amount,
minAmount,
price,
useDefaultTxFee,
useMarketBasedPrice,
marketPriceMargin,
buyerSecurityDeposit,

View File

@ -124,6 +124,7 @@ public class CreateOfferService {
Coin amount,
Coin minAmount,
Price price,
Coin txFee,
boolean useMarketBasedPrice,
double marketPriceMargin,
double buyerSecurityDepositAsDouble,
@ -183,6 +184,7 @@ public class CreateOfferService {
List<String> acceptedBanks = PaymentAccountUtil.getAcceptedBanks(paymentAccount);
double sellerSecurityDeposit = getSellerSecurityDepositAsDouble();
Coin txFeeFromFeeService = getEstimatedFeeAndTxSize(amount, direction, buyerSecurityDepositAsDouble, sellerSecurityDeposit).first;
Coin txFeeToUse = txFee.isPositive() ? txFee : txFeeFromFeeService;
Coin makerFeeAsCoin = getMakerFee(amount);
boolean isCurrencyForMakerFeeBtc = OfferUtil.isCurrencyForMakerFeeBtc(preferences, bsqWalletService, amount);
Coin buyerSecurityDepositAsCoin = getBuyerSecurityDeposit(amount, buyerSecurityDepositAsDouble);
@ -233,7 +235,7 @@ public class CreateOfferService {
acceptedBanks,
Version.VERSION,
btcWalletService.getLastBlockSeenHeight(),
txFeeFromFeeService.value,
txFeeToUse.value,
makerFeeAsCoin.value,
isCurrencyForMakerFeeBtc,
buyerSecurityDepositAsCoin.value,

View File

@ -282,6 +282,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs
amount.get(),
minAmount.get(),
price.get(),
txFeeFromFeeService,
useMarketBasedPrice.get(),
marketPriceMargin,
buyerSecurityDeposit.get(),