mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-20 10:22:18 +01:00
Add checks for isBaseCurrencySupportingBsq
This commit is contained in:
parent
705bcb2f38
commit
f3f05413fe
@ -18,7 +18,7 @@ public class DevEnv {
|
||||
// If set to true we ignore several UI behavior like confirmation popups as well dummy accounts are created and
|
||||
// offers are filled with default values. Intended to make dev testing faster.
|
||||
@SuppressWarnings("PointlessBooleanExpression")
|
||||
public static final boolean DEV_MODE = STRESS_TEST_MODE || true;
|
||||
public static final boolean DEV_MODE = STRESS_TEST_MODE || false;
|
||||
|
||||
public static final boolean DAO_ACTIVATED = true;
|
||||
public static final boolean DAO_PHASE2_ACTIVATED = false;
|
||||
|
@ -23,6 +23,7 @@ import io.bisq.common.crypto.PubKeyRing;
|
||||
import io.bisq.common.proto.ProtoUtil;
|
||||
import io.bisq.common.proto.persistable.PersistablePayload;
|
||||
import io.bisq.common.taskrunner.Model;
|
||||
import io.bisq.core.app.BisqEnvironment;
|
||||
import io.bisq.core.btc.data.RawTransactionInput;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
import io.bisq.core.btc.wallet.BtcWalletService;
|
||||
@ -298,9 +299,13 @@ public class ProcessModel implements Model, PersistablePayload {
|
||||
return Coin.valueOf(fundsNeededForTradeAsLong);
|
||||
}
|
||||
|
||||
public Transaction getTakeOfferFeeTx() {
|
||||
if (takeOfferFeeTx == null)
|
||||
takeOfferFeeTx = bsqWalletService.getTransaction(Sha256Hash.wrap(takeOfferFeeTxId));
|
||||
public Transaction resolveTakeOfferFeeTx(Trade trade) {
|
||||
if (takeOfferFeeTx == null) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq() && !trade.isCurrencyForTakerFeeBtc())
|
||||
takeOfferFeeTx = bsqWalletService.getTransaction(Sha256Hash.wrap(takeOfferFeeTxId));
|
||||
else
|
||||
takeOfferFeeTx = btcWalletService.getTransaction(Sha256Hash.wrap(takeOfferFeeTxId));
|
||||
}
|
||||
return takeOfferFeeTx;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class TakerPublishTakerFeeTx extends TradeTask {
|
||||
protected void run() {
|
||||
try {
|
||||
runInterceptHook();
|
||||
processModel.getTradeWalletService().broadcastTx(processModel.getTakeOfferFeeTx(),
|
||||
processModel.getTradeWalletService().broadcastTx(processModel.resolveTakeOfferFeeTx(trade),
|
||||
new FutureCallback<Transaction>() {
|
||||
@Override
|
||||
public void onSuccess(Transaction transaction) {
|
||||
|
@ -30,8 +30,6 @@ import io.bisq.gui.main.MainView;
|
||||
import io.bisq.gui.main.disputes.arbitrator.ArbitratorDisputeView;
|
||||
import io.bisq.gui.main.disputes.trader.TraderDisputeView;
|
||||
import io.bisq.gui.main.overlays.popups.Popup;
|
||||
import io.bisq.gui.main.portfolio.PortfolioView;
|
||||
import io.bisq.gui.main.portfolio.pendingtrades.PendingTradesView;
|
||||
import io.bisq.network.p2p.NodeAddress;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.collections.MapChangeListener;
|
||||
@ -133,8 +131,6 @@ public class DisputesView extends ActivatableViewAndModel<TabPane, Activatable>
|
||||
//noinspection unchecked
|
||||
new Popup<>().backgroundInfo(Res.get("support.backgroundInfo"))
|
||||
.width(900)
|
||||
.actionButtonTextWithGoTo("navigation.portfolio.pending")
|
||||
.onAction(() -> navigation.navigateTo(MainView.class, PortfolioView.class, PendingTradesView.class))
|
||||
.dontShowAgainId(key)
|
||||
.show();
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
package io.bisq.gui.main.funds.transactions;
|
||||
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.core.app.BisqEnvironment;
|
||||
import io.bisq.core.btc.listeners.TxConfidenceListener;
|
||||
import io.bisq.core.btc.wallet.BsqWalletService;
|
||||
import io.bisq.core.btc.wallet.BtcWalletService;
|
||||
@ -87,7 +88,7 @@ class TransactionsListItem {
|
||||
for (TransactionOutput output : transaction.getOutputs()) {
|
||||
if (!btcWalletService.isTransactionOutputMine(output)) {
|
||||
received = false;
|
||||
if (bsqWalletService.isTransactionOutputMine(output)) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq() && bsqWalletService.isTransactionOutputMine(output)) {
|
||||
txFeeForBsqPayment = true;
|
||||
} else {
|
||||
direction = Res.get("funds.tx.direction.sentTo");
|
||||
@ -114,7 +115,7 @@ class TransactionsListItem {
|
||||
boolean outgoing = false;
|
||||
for (TransactionOutput output : transaction.getOutputs()) {
|
||||
if (!btcWalletService.isTransactionOutputMine(output)) {
|
||||
if (bsqWalletService.isTransactionOutputMine(output)) {
|
||||
if (BisqEnvironment.isBaseCurrencySupportingBsq() && bsqWalletService.isTransactionOutputMine(output)) {
|
||||
outgoing = false;
|
||||
txFeeForBsqPayment = true;
|
||||
} else {
|
||||
|
@ -23,6 +23,7 @@ import io.bisq.common.locale.CurrencyUtil;
|
||||
import io.bisq.common.locale.Res;
|
||||
import io.bisq.common.monetary.Price;
|
||||
import io.bisq.common.monetary.Volume;
|
||||
import io.bisq.core.app.BisqEnvironment;
|
||||
import io.bisq.core.btc.AddressEntry;
|
||||
import io.bisq.core.btc.Restrictions;
|
||||
import io.bisq.core.btc.listeners.BalanceListener;
|
||||
@ -332,7 +333,11 @@ class TakeOfferDataModel extends ActivatableDataModel {
|
||||
}
|
||||
|
||||
boolean isBsqForFeeAvailable() {
|
||||
return getTakerFee(false) != null && bsqWalletService.getAvailableBalance() != null && !bsqWalletService.getAvailableBalance().subtract(getTakerFee(false)).isNegative();
|
||||
return BisqEnvironment.isBaseCurrencySupportingBsq() &&
|
||||
getTakerFee(false) != null &&
|
||||
bsqWalletService.getAvailableBalance() != null &&
|
||||
getTakerFee(false) != null &&
|
||||
!bsqWalletService.getAvailableBalance().subtract(getTakerFee(false)).isNegative();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user