diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 71bbb97b..7c2e2626 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -178,6 +178,7 @@ public class SendController extends WalletFormController implements Initializabl setFiatFeeAmount(AppServices.getFiatCurrencyExchangeRate(), getFeeValueSats()); } + createButton.setDisable(isInsufficientFeeRate()); setTargetBlocks(getTargetBlocks()); updateTransaction(); } @@ -456,8 +457,8 @@ public class SendController extends WalletFormController implements Initializabl validationSupport.setValidationDecorator(new StyleClassValidationDecoration()); validationSupport.registerValidator(fee, Validator.combine( (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Inputs", userFeeSet.get() && insufficientInputsProperty.get()), - (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee", getFeeValueSats() == null || getFeeValueSats() == 0), - (Control c, String newValue) -> ValidationResult.fromWarningIf( c, "Insufficient Fee Rate", isInsufficientFeeRate()) + (Control c, String newValue) -> ValidationResult.fromErrorIf( c, "Insufficient Fee", isInsufficientFeeRate()), + (Control c, String newValue) -> ValidationResult.fromWarningIf( c, "Fee Rate Below Minimum", isBelowMinimumFeeRate()) )); validationSupport.setErrorDecorationEnabled(false); @@ -862,10 +863,14 @@ public class SendController extends WalletFormController implements Initializabl return AppServices.getMempoolHistogram(); } - public boolean isInsufficientFeeRate() { + public boolean isBelowMinimumFeeRate() { return walletTransactionProperty.get() != null && walletTransactionProperty.get().getFeeRate() < AppServices.getMinimumRelayFeeRate(); } + public boolean isInsufficientFeeRate() { + return getFeeValueSats() == null || getFeeValueSats() == 0; + } + private void setFeeRate(Double feeRateAmt) { UnitFormat format = Config.get().getUnitFormat() == null ? UnitFormat.DOT : Config.get().getUnitFormat(); feeRate.setText(format.getCurrencyFormat().format(feeRateAmt) + (cpfpFeeRate.isVisible() ? "" : " sats/vB"));