mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 07:07:43 +01:00
Fix missing impl at Utilities.getFeePerByte. Move btcj dependent methods from common Utilities to CoinUtil in core.
This commit is contained in:
parent
f31dd06330
commit
23b86922ad
13 changed files with 142 additions and 111 deletions
|
@ -28,7 +28,6 @@ import javafx.scene.input.Clipboard;
|
|||
import javafx.scene.input.ClipboardContent;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -398,21 +397,6 @@ public class Utilities {
|
|||
Thread.currentThread().setName(name + "-" + new Random().nextInt(10000));
|
||||
}
|
||||
|
||||
public static Coin getFeePerBtc(Coin feePerBtc, Coin amount) {
|
||||
double feePerBtcAsDouble = (double) feePerBtc.value;
|
||||
double amountAsDouble = (double) amount.value;
|
||||
double btcAsDouble = (double) Coin.COIN.value;
|
||||
return Coin.valueOf(Math.round(feePerBtcAsDouble * (amountAsDouble / btcAsDouble)));
|
||||
}
|
||||
|
||||
public static Coin minCoin(Coin a, Coin b) {
|
||||
return a.compareTo(b) <= 0 ? a : b;
|
||||
}
|
||||
|
||||
public static Coin maxCoin(Coin a, Coin b) {
|
||||
return a.compareTo(b) >= 0 ? a : b;
|
||||
}
|
||||
|
||||
public static void overwriteWithRandomBytes(byte[] bytes) {
|
||||
Random random = new Random();
|
||||
for (int i = 0; i < bytes.length; i++) {
|
||||
|
@ -428,10 +412,6 @@ public class Utilities {
|
|||
return Utilities.isWindows() ? System.getenv("USERPROFILE") : System.getProperty("user.home");
|
||||
}
|
||||
|
||||
public static double getFeePerByte(Coin miningFee, int txSize) {
|
||||
return Utilities.getFeePerByte(miningFee, txSize);
|
||||
}
|
||||
|
||||
private static class AnnotationExclusionStrategy implements ExclusionStrategy {
|
||||
@Override
|
||||
public boolean shouldSkipField(FieldAttributes f) {
|
||||
|
|
|
@ -20,7 +20,6 @@ package io.bisq.storage;
|
|||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.util.Utilities;
|
||||
import io.bisq.io.LookAheadObjectInputStream;
|
||||
import org.bitcoinj.core.Utils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -230,7 +229,7 @@ public class FileManager<T> {
|
|||
}
|
||||
|
||||
private synchronized void renameTempFileToFile(File tempFile, File file) throws IOException {
|
||||
if (Utils.isWindows()) {
|
||||
if (Utilities.isWindows()) {
|
||||
// Work around an issue on Windows whereby you can't rename over existing files.
|
||||
final File canonical = file.getCanonicalFile();
|
||||
if (canonical.exists() && !canonical.delete()) {
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* This file is part of bisq.
|
||||
*
|
||||
* bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bisq.common.util;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class UtilitiesTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(UtilitiesTest.class);
|
||||
|
||||
@Test
|
||||
public void testGetFeePerBtc() {
|
||||
assertEquals(Coin.parseCoin("1"), Utilities.getFeePerBtc(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), Utilities.getFeePerBtc(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.01"), Utilities.getFeePerBtc(Coin.parseCoin("0.1"), Coin.parseCoin("0.1")));
|
||||
assertEquals(Coin.parseCoin("0.015"), Utilities.getFeePerBtc(Coin.parseCoin("0.3"), Coin.parseCoin("0.05")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinCoin() {
|
||||
assertEquals(Coin.parseCoin("1"), Utilities.minCoin(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), Utilities.minCoin(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.01"), Utilities.minCoin(Coin.parseCoin("0.1"), Coin.parseCoin("0.01")));
|
||||
assertEquals(Coin.parseCoin("0"), Utilities.minCoin(Coin.parseCoin("0"), Coin.parseCoin("0.05")));
|
||||
assertEquals(Coin.parseCoin("0"), Utilities.minCoin(Coin.parseCoin("0.05"), Coin.parseCoin("0")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaxCoin() {
|
||||
assertEquals(Coin.parseCoin("1"), Utilities.maxCoin(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("1"), Utilities.maxCoin(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), Utilities.maxCoin(Coin.parseCoin("0.1"), Coin.parseCoin("0.01")));
|
||||
assertEquals(Coin.parseCoin("0.05"), Utilities.maxCoin(Coin.parseCoin("0"), Coin.parseCoin("0.05")));
|
||||
assertEquals(Coin.parseCoin("0.05"), Utilities.maxCoin(Coin.parseCoin("0.05"), Coin.parseCoin("0")));
|
||||
}
|
||||
|
||||
}
|
48
core/src/main/java/io/bisq/util/CoinUtil.java
Normal file
48
core/src/main/java/io/bisq/util/CoinUtil.java
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bisq.util;
|
||||
|
||||
import io.bisq.common.util.MathUtils;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class CoinUtil {
|
||||
private static final Logger log = LoggerFactory.getLogger(CoinUtil.class);
|
||||
|
||||
|
||||
public static Coin getFeePerBtc(Coin feePerBtc, Coin amount) {
|
||||
double feePerBtcAsDouble = (double) feePerBtc.value;
|
||||
double amountAsDouble = (double) amount.value;
|
||||
double btcAsDouble = (double) Coin.COIN.value;
|
||||
return Coin.valueOf(Math.round(feePerBtcAsDouble * (amountAsDouble / btcAsDouble)));
|
||||
}
|
||||
|
||||
public static Coin minCoin(Coin a, Coin b) {
|
||||
return a.compareTo(b) <= 0 ? a : b;
|
||||
}
|
||||
|
||||
public static Coin maxCoin(Coin a, Coin b) {
|
||||
return a.compareTo(b) >= 0 ? a : b;
|
||||
}
|
||||
|
||||
public static double getFeePerByte(Coin miningFee, int txSize) {
|
||||
return MathUtils.roundDouble(((double) miningFee.value / (double) txSize), 2);
|
||||
}
|
||||
|
||||
}
|
57
core/src/test/java/io/bisq/util/CoinUtilTest.java
Normal file
57
core/src/test/java/io/bisq/util/CoinUtilTest.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This file is part of bisq.
|
||||
*
|
||||
* bisq is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* bisq is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bisq.util;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class CoinUtilTest {
|
||||
private static final Logger log = LoggerFactory.getLogger(CoinUtilTest.class);
|
||||
|
||||
@Test
|
||||
public void testGetFeePerBtc() {
|
||||
Assert.assertEquals(Coin.parseCoin("1"), CoinUtil.getFeePerBtc(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), CoinUtil.getFeePerBtc(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.01"), CoinUtil.getFeePerBtc(Coin.parseCoin("0.1"), Coin.parseCoin("0.1")));
|
||||
assertEquals(Coin.parseCoin("0.015"), CoinUtil.getFeePerBtc(Coin.parseCoin("0.3"), Coin.parseCoin("0.05")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinCoin() {
|
||||
assertEquals(Coin.parseCoin("1"), CoinUtil.minCoin(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), CoinUtil.minCoin(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.01"), CoinUtil.minCoin(Coin.parseCoin("0.1"), Coin.parseCoin("0.01")));
|
||||
assertEquals(Coin.parseCoin("0"), CoinUtil.minCoin(Coin.parseCoin("0"), Coin.parseCoin("0.05")));
|
||||
assertEquals(Coin.parseCoin("0"), CoinUtil.minCoin(Coin.parseCoin("0.05"), Coin.parseCoin("0")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMaxCoin() {
|
||||
assertEquals(Coin.parseCoin("1"), CoinUtil.maxCoin(Coin.parseCoin("1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("1"), CoinUtil.maxCoin(Coin.parseCoin("0.1"), Coin.parseCoin("1")));
|
||||
assertEquals(Coin.parseCoin("0.1"), CoinUtil.maxCoin(Coin.parseCoin("0.1"), Coin.parseCoin("0.01")));
|
||||
assertEquals(Coin.parseCoin("0.05"), CoinUtil.maxCoin(Coin.parseCoin("0"), Coin.parseCoin("0.05")));
|
||||
assertEquals(Coin.parseCoin("0.05"), CoinUtil.maxCoin(Coin.parseCoin("0.05"), Coin.parseCoin("0")));
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,6 @@ import io.bisq.btc.exceptions.WalletException;
|
|||
import io.bisq.btc.wallet.BsqWalletService;
|
||||
import io.bisq.btc.wallet.BtcWalletService;
|
||||
import io.bisq.btc.wallet.ChangeBelowDustException;
|
||||
import io.bisq.network_messages.crypto.KeyRing;
|
||||
import io.bisq.common.util.Utilities;
|
||||
import io.bisq.dao.compensation.CompensationRequestManager;
|
||||
import io.bisq.gui.common.view.ActivatableView;
|
||||
|
@ -34,10 +33,12 @@ import io.bisq.gui.main.dao.compensation.CompensationRequestDisplay;
|
|||
import io.bisq.gui.main.overlays.popups.Popup;
|
||||
import io.bisq.gui.util.BSFormatter;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.provider.fee.FeeService;
|
||||
import io.bisq.network_messages.dao.compensation.payload.CompensationRequestPayload;
|
||||
import io.bisq.network_messages.NodeAddress;
|
||||
import io.bisq.network_messages.crypto.KeyRing;
|
||||
import io.bisq.network_messages.dao.compensation.payload.CompensationRequestPayload;
|
||||
import io.bisq.p2p.storage.P2PService;
|
||||
import io.bisq.provider.fee.FeeService;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
@ -164,7 +165,7 @@ public class CreateCompensationRequestView extends ActivatableView<GridPane, Voi
|
|||
.confirmation(Res.get("dao.tx.summary",
|
||||
btcFormatter.formatCoinWithCode(createCompensationRequestFee),
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
CoinUtil.getFeePerByte(miningFee, txSize),
|
||||
(txSize / 1000d)))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
|
|
|
@ -25,7 +25,6 @@ import io.bisq.btc.wallet.BsqWalletService;
|
|||
import io.bisq.btc.wallet.BtcWalletService;
|
||||
import io.bisq.btc.wallet.ChangeBelowDustException;
|
||||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.util.Utilities;
|
||||
import io.bisq.dao.compensation.CompensationRequest;
|
||||
import io.bisq.dao.compensation.CompensationRequestManager;
|
||||
import io.bisq.dao.vote.*;
|
||||
|
@ -38,6 +37,7 @@ import io.bisq.gui.util.BsqFormatter;
|
|||
import io.bisq.gui.util.Layout;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.provider.fee.FeeService;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
|
@ -222,7 +222,7 @@ public class VoteView extends ActivatableView<GridPane, Void> {
|
|||
.confirmation(Res.get("dao.tx.summary",
|
||||
btcFormatter.formatCoinWithCode(votingTxFee),
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
CoinUtil.getFeePerByte(miningFee, txSize),
|
||||
(txSize / 1000d)))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
.onAction(() -> {
|
||||
|
|
|
@ -24,7 +24,6 @@ import io.bisq.btc.exceptions.TransactionVerificationException;
|
|||
import io.bisq.btc.exceptions.WalletException;
|
||||
import io.bisq.btc.wallet.BsqWalletService;
|
||||
import io.bisq.btc.wallet.BtcWalletService;
|
||||
import io.bisq.common.util.Utilities;
|
||||
import io.bisq.gui.common.view.ActivatableView;
|
||||
import io.bisq.gui.common.view.FxmlView;
|
||||
import io.bisq.gui.components.InputTextField;
|
||||
|
@ -35,6 +34,7 @@ import io.bisq.gui.util.BsqFormatter;
|
|||
import io.bisq.gui.util.Layout;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.provider.fee.FeeService;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.GridPane;
|
||||
|
@ -118,7 +118,7 @@ public class BsqSendView extends ActivatableView<GridPane, Void> {
|
|||
bsqFormatter.formatCoinWithCode(receiverAmount),
|
||||
receiversAddressString,
|
||||
btcFormatter.formatCoinWithCode(miningFee),
|
||||
Utilities.getFeePerByte(miningFee, txSize),
|
||||
CoinUtil.getFeePerByte(miningFee, txSize),
|
||||
txSize / 1000d,
|
||||
bsqFormatter.formatCoinWithCode(receiverAmount.subtract(miningFee))))
|
||||
.actionButtonText(Res.get("shared.yes"))
|
||||
|
|
|
@ -26,7 +26,6 @@ import io.bisq.btc.InsufficientFundsException;
|
|||
import io.bisq.btc.listeners.BalanceListener;
|
||||
import io.bisq.btc.wallet.BtcWalletService;
|
||||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.util.MathUtils;
|
||||
import io.bisq.gui.common.view.ActivatableView;
|
||||
import io.bisq.gui.common.view.FxmlView;
|
||||
import io.bisq.gui.components.HyperlinkWithIcon;
|
||||
|
@ -37,12 +36,13 @@ import io.bisq.gui.util.GUIUtil;
|
|||
import io.bisq.gui.util.validation.BtcAddressValidator;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.provider.fee.FeeService;
|
||||
import io.bisq.user.Preferences;
|
||||
import io.bisq.trade.Tradable;
|
||||
import io.bisq.trade.Trade;
|
||||
import io.bisq.trade.TradeManager;
|
||||
import io.bisq.trade.closed.ClosedTradableManager;
|
||||
import io.bisq.trade.failed.FailedTradesManager;
|
||||
import io.bisq.user.Preferences;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.ReadOnlyObjectWrapper;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
|
@ -248,7 +248,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
if (DevEnv.DEV_MODE) {
|
||||
doWithdraw(amount, fee, callback);
|
||||
} else {
|
||||
double feePerByte = MathUtils.roundDouble(((double) fee.value / (double) txSize), 2);
|
||||
double feePerByte = CoinUtil.getFeePerByte(fee, txSize);
|
||||
double kb = txSize / 1000d;
|
||||
new Popup().headLine(Res.get("funds.withdrawal.confirmWithdrawalRequest"))
|
||||
.confirmation(Res.get("shared.sendFundsDetailsWithFee",
|
||||
|
|
|
@ -33,7 +33,6 @@ import io.bisq.gui.util.BSFormatter;
|
|||
import io.bisq.locale.CurrencyUtil;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.locale.TradeCurrency;
|
||||
import io.bisq.network_messages.arbitration.Arbitrator;
|
||||
import io.bisq.network_messages.btc.Restrictions;
|
||||
import io.bisq.network_messages.crypto.KeyRing;
|
||||
import io.bisq.network_messages.payment.payload.BankAccountContractData;
|
||||
|
@ -47,6 +46,7 @@ import io.bisq.trade.handlers.TransactionResultHandler;
|
|||
import io.bisq.trade.offer.OpenOfferManager;
|
||||
import io.bisq.user.Preferences;
|
||||
import io.bisq.user.User;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
|
@ -633,10 +633,10 @@ class CreateOfferDataModel extends ActivatableDataModel {
|
|||
void updateTradeFee() {
|
||||
Coin amount = this.amount.get();
|
||||
if (amount != null) {
|
||||
createOfferFeeAsCoin = Utilities.getFeePerBtc(feeService.getCreateOfferFeeInBtcPerBtc(), amount);
|
||||
createOfferFeeAsCoin = CoinUtil.getFeePerBtc(feeService.getCreateOfferFeeInBtcPerBtc(), amount);
|
||||
// We don't want too fractional btc values so we use only a divide by 10 instead of 100
|
||||
createOfferFeeAsCoin = createOfferFeeAsCoin.divide(10).multiply(Math.round(marketPriceMargin * 1_000));
|
||||
createOfferFeeAsCoin = Utilities.maxCoin(createOfferFeeAsCoin, feeService.getMinCreateOfferFeeInBtc());
|
||||
createOfferFeeAsCoin = CoinUtil.maxCoin(createOfferFeeAsCoin, feeService.getMinCreateOfferFeeInBtc());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import io.bisq.app.DevEnv;
|
|||
import io.bisq.btc.AddressEntry;
|
||||
import io.bisq.btc.listeners.BalanceListener;
|
||||
import io.bisq.btc.wallet.BtcWalletService;
|
||||
import io.bisq.common.util.Utilities;
|
||||
import io.bisq.gui.common.model.ActivatableDataModel;
|
||||
import io.bisq.gui.main.overlays.notifications.Notification;
|
||||
import io.bisq.gui.main.overlays.popups.Popup;
|
||||
|
@ -41,6 +40,7 @@ import io.bisq.trade.TradeManager;
|
|||
import io.bisq.trade.handlers.TradeResultHandler;
|
||||
import io.bisq.user.Preferences;
|
||||
import io.bisq.user.User;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.beans.property.*;
|
||||
import javafx.collections.ObservableList;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -355,8 +355,8 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
|||
void applyAmount(Coin amount) {
|
||||
amountAsCoin.set(amount);
|
||||
|
||||
takerFeeAsCoin = Utilities.getFeePerBtc(feeService.getTakeOfferFeeInBtcPerBtc(), amount);
|
||||
takerFeeAsCoin = Utilities.maxCoin(takerFeeAsCoin, feeService.getMinTakeOfferFeeInBtc());
|
||||
takerFeeAsCoin = CoinUtil.getFeePerBtc(feeService.getTakeOfferFeeInBtcPerBtc(), amount);
|
||||
takerFeeAsCoin = CoinUtil.maxCoin(takerFeeAsCoin, feeService.getMinTakeOfferFeeInBtc());
|
||||
|
||||
calculateTotalToPay();
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import io.bisq.btc.wallet.BtcWalletService;
|
|||
import io.bisq.common.UserThread;
|
||||
import io.bisq.common.handlers.FaultHandler;
|
||||
import io.bisq.common.handlers.ResultHandler;
|
||||
import io.bisq.common.util.MathUtils;
|
||||
import io.bisq.common.util.Tuple2;
|
||||
import io.bisq.gui.components.InputTextField;
|
||||
import io.bisq.gui.main.MainView;
|
||||
|
@ -40,6 +39,7 @@ import io.bisq.gui.util.BSFormatter;
|
|||
import io.bisq.gui.util.Layout;
|
||||
import io.bisq.locale.Res;
|
||||
import io.bisq.network_messages.btc.Restrictions;
|
||||
import io.bisq.util.CoinUtil;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.scene.control.Button;
|
||||
|
@ -193,7 +193,7 @@ public class BuyerStep5View extends TradeStepView {
|
|||
String key = "reviewWithdrawalAtTradeComplete";
|
||||
if (!DevEnv.DEV_MODE && preferences.showAgain(key)) {
|
||||
int txSize = feeEstimationTransaction.bitcoinSerialize().length;
|
||||
double feePerByte = MathUtils.roundDouble(((double) fee.value / (double) txSize), 2);
|
||||
double feePerByte = CoinUtil.getFeePerByte(fee, txSize);
|
||||
double kb = txSize / 1000d;
|
||||
String recAmount = formatter.formatCoinWithCode(receiverAmount);
|
||||
new Popup().headLine(Res.get("portfolio.pending.step5_buyer.confirmWithdrawal"))
|
||||
|
|
30
pom.xml
30
pom.xml
|
@ -94,9 +94,9 @@
|
|||
|
||||
<dependencies>
|
||||
<!--bitcoinj
|
||||
Needs local installation!
|
||||
See doc/build.md for further info
|
||||
-->
|
||||
Needs local installation!
|
||||
See doc/build.md for further info
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.bitcoinj</groupId>
|
||||
<artifactId>bitcoinj-core</artifactId>
|
||||
|
@ -135,6 +135,13 @@
|
|||
<version>1.53</version>
|
||||
</dependency>
|
||||
|
||||
<!--http-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--utils-->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
|
@ -182,12 +189,6 @@
|
|||
<artifactId>protobuf-java</artifactId>
|
||||
<version>3.2.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--logging-->
|
||||
<dependency>
|
||||
|
@ -225,17 +226,18 @@
|
|||
<version>1.30</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-test</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
Loading…
Add table
Reference in a new issue