Add isReadyForTxBroadcast check for WithdrawalView

This commit is contained in:
Manfred Karrer 2018-01-20 09:04:36 -05:00
parent a805d5fd0e
commit 725bf14b22
No known key found for this signature in database
GPG key ID: 401250966A6B2C46

View file

@ -27,6 +27,7 @@ import io.bisq.core.btc.InsufficientFundsException;
import io.bisq.core.btc.Restrictions;
import io.bisq.core.btc.listeners.BalanceListener;
import io.bisq.core.btc.wallet.BtcWalletService;
import io.bisq.core.btc.wallet.WalletsSetup;
import io.bisq.core.trade.Tradable;
import io.bisq.core.trade.Trade;
import io.bisq.core.trade.TradeManager;
@ -42,6 +43,7 @@ import io.bisq.gui.main.overlays.windows.WalletPasswordWindow;
import io.bisq.gui.util.BSFormatter;
import io.bisq.gui.util.GUIUtil;
import io.bisq.gui.util.validation.BtcAddressValidator;
import io.bisq.network.p2p.P2PService;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyObjectWrapper;
import javafx.beans.property.SimpleBooleanProperty;
@ -89,6 +91,8 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
private final TradeManager tradeManager;
private final ClosedTradableManager closedTradableManager;
private final FailedTradesManager failedTradesManager;
private final P2PService p2PService;
private final WalletsSetup walletsSetup;
private final BSFormatter formatter;
private final Preferences preferences;
private final BtcAddressValidator btcAddressValidator;
@ -118,13 +122,18 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
TradeManager tradeManager,
ClosedTradableManager closedTradableManager,
FailedTradesManager failedTradesManager,
BSFormatter formatter, Preferences preferences,
P2PService p2PService,
WalletsSetup walletsSetup,
BSFormatter formatter,
Preferences preferences,
BtcAddressValidator btcAddressValidator,
WalletPasswordWindow walletPasswordWindow) {
this.walletService = walletService;
this.tradeManager = tradeManager;
this.closedTradableManager = closedTradableManager;
this.failedTradesManager = failedTradesManager;
this.p2PService = p2PService;
this.walletsSetup = walletsSetup;
this.formatter = formatter;
this.preferences = preferences;
this.btcAddressValidator = btcAddressValidator;
@ -252,6 +261,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
@FXML
public void onWithdraw() {
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
try {
// We do not know sendersAmount if senderPaysFee is true. We repeat fee calculation after first attempt if senderPaysFee is true.
Transaction feeEstimationTransaction = walletService.getFeeEstimationTransactionForMultipleAddresses(fromAddresses, amountAsCoin);
@ -319,6 +329,9 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
log.error(e.toString());
new Popup<>().warning(e.toString()).show();
}
} else {
GUIUtil.showNotReadyForTxBroadcastPopups(p2PService, walletsSetup);
}
}
private void selectForWithdrawal(WithdrawalListItem item) {