mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-24 23:18:17 +01:00
Add isReadyForTxBroadcast check for ManualPayoutTxWindow
This commit is contained in:
parent
9cf9ce6ea4
commit
1943cd2298
1 changed files with 33 additions and 22 deletions
|
@ -22,9 +22,12 @@ import io.bisq.common.UserThread;
|
||||||
import io.bisq.core.btc.exceptions.TransactionVerificationException;
|
import io.bisq.core.btc.exceptions.TransactionVerificationException;
|
||||||
import io.bisq.core.btc.exceptions.WalletException;
|
import io.bisq.core.btc.exceptions.WalletException;
|
||||||
import io.bisq.core.btc.wallet.TradeWalletService;
|
import io.bisq.core.btc.wallet.TradeWalletService;
|
||||||
|
import io.bisq.core.btc.wallet.WalletsSetup;
|
||||||
import io.bisq.gui.components.InputTextField;
|
import io.bisq.gui.components.InputTextField;
|
||||||
import io.bisq.gui.main.overlays.Overlay;
|
import io.bisq.gui.main.overlays.Overlay;
|
||||||
import io.bisq.gui.main.overlays.popups.Popup;
|
import io.bisq.gui.main.overlays.popups.Popup;
|
||||||
|
import io.bisq.gui.util.GUIUtil;
|
||||||
|
import io.bisq.network.p2p.P2PService;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
import org.bitcoinj.core.AddressFormatException;
|
import org.bitcoinj.core.AddressFormatException;
|
||||||
|
@ -42,14 +45,18 @@ import static io.bisq.gui.util.FormBuilder.addLabelInputTextField;
|
||||||
public class ManualPayoutTxWindow extends Overlay<ManualPayoutTxWindow> {
|
public class ManualPayoutTxWindow extends Overlay<ManualPayoutTxWindow> {
|
||||||
private static final Logger log = LoggerFactory.getLogger(ManualPayoutTxWindow.class);
|
private static final Logger log = LoggerFactory.getLogger(ManualPayoutTxWindow.class);
|
||||||
private final TradeWalletService tradeWalletService;
|
private final TradeWalletService tradeWalletService;
|
||||||
|
private final P2PService p2PService;
|
||||||
|
private final WalletsSetup walletsSetup;
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Public API
|
// Public API
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
public ManualPayoutTxWindow(TradeWalletService tradeWalletService) {
|
public ManualPayoutTxWindow(TradeWalletService tradeWalletService, P2PService p2PService, WalletsSetup walletsSetup) {
|
||||||
this.tradeWalletService = tradeWalletService;
|
this.tradeWalletService = tradeWalletService;
|
||||||
|
this.p2PService = p2PService;
|
||||||
|
this.walletsSetup = walletsSetup;
|
||||||
type = Type.Attention;
|
type = Type.Attention;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +163,7 @@ public class ManualPayoutTxWindow extends Overlay<ManualPayoutTxWindow> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
onAction(() -> {
|
onAction(() -> {
|
||||||
|
if (GUIUtil.isReadyForTxBroadcast(p2PService, walletsSetup)) {
|
||||||
try {
|
try {
|
||||||
tradeWalletService.emergencySignAndPublishPayoutTx(depositTxHex.getText(),
|
tradeWalletService.emergencySignAndPublishPayoutTx(depositTxHex.getText(),
|
||||||
Coin.parseCoin(buyerPayoutAmount.getText()),
|
Coin.parseCoin(buyerPayoutAmount.getText()),
|
||||||
|
@ -178,6 +186,9 @@ public class ManualPayoutTxWindow extends Overlay<ManualPayoutTxWindow> {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
UserThread.execute(() -> new Popup<>().warning(e.toString()).show());
|
UserThread.execute(() -> new Popup<>().warning(e.toString()).show());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
GUIUtil.showNotReadyForTxBroadcastPopups(p2PService, walletsSetup);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue