show warning dialog on broadcast if a transaction has a fee rate beyond the range slider maximum

This commit is contained in:
Craig Raw 2024-09-13 09:30:58 +02:00
parent deb47ca002
commit 0646c8aa28

View file

@ -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<ButtonType> 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());