From 0646c8aa282c8b2bb27828eea70d7f9c424df4b4 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Fri, 13 Sep 2024 09:30:58 +0200 Subject: [PATCH] show warning dialog on broadcast if a transaction has a fee rate beyond the range slider maximum --- .../sparrow/transaction/HeadersController.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java index 22ca6af9..bb719c2a 100644 --- a/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java +++ b/src/main/java/com/sparrowwallet/sparrow/transaction/HeadersController.java @@ -1121,6 +1121,18 @@ public class HeadersController extends TransactionFormController implements Init extractTransaction(event); } + if(fee.getValue() > 0) { + double feeRateAmt = fee.getValue() / headersForm.getTransaction().getVirtualSize(); + if(feeRateAmt > AppServices.LONG_FEE_RATES_RANGE.get(AppServices.LONG_FEE_RATES_RANGE.size() - 1)) { + Optional optType = AppServices.showWarningDialog("Very high fee rate!", + "This transaction pays a very high fee rate of " + String.format("%.0f", feeRateAmt) + " sats/vB.\n\nBroadcast this transaction?", ButtonType.YES, ButtonType.NO); + if(optType.isPresent() && optType.get() == ButtonType.NO) { + broadcastButton.setDisable(false); + return; + } + } + } + if(headersForm.getSigningWallet() instanceof FinalizingPSBTWallet) { //Ensure the script hashes of the UTXOs in FinalizingPSBTWallet are subscribed to ElectrumServer.TransactionHistoryService historyService = new ElectrumServer.TransactionHistoryService(headersForm.getSigningWallet());