mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
follow up to previous commit
This commit is contained in:
parent
65e13d7b50
commit
8865f4946a
3 changed files with 26 additions and 7 deletions
|
@ -489,7 +489,7 @@ public class HeadersController extends TransactionFormController implements Init
|
||||||
private void updateFee(Long feeAmt) {
|
private void updateFee(Long feeAmt) {
|
||||||
fee.setValue(feeAmt);
|
fee.setValue(feeAmt);
|
||||||
double feeRateAmt = feeAmt.doubleValue() / headersForm.getTransaction().getVirtualSize();
|
double feeRateAmt = feeAmt.doubleValue() / headersForm.getTransaction().getVirtualSize();
|
||||||
feeRate.setText(String.format("%.2f", feeRateAmt) + " sats/vByte" + (headersForm.isTransactionFinalized() ? "" : " (non-final)"));
|
feeRate.setText(String.format("%.2f", feeRateAmt) + " sats/vB" + (headersForm.isTransactionFinalized() ? "" : " (non-final)"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBlockchainForm(BlockTransaction blockTransaction, Integer currentHeight) {
|
private void updateBlockchainForm(BlockTransaction blockTransaction, Integer currentHeight) {
|
||||||
|
|
|
@ -309,4 +309,9 @@ public class ReceiveController extends WalletFormController implements Initializ
|
||||||
public void connection(ConnectionEvent event) {
|
public void connection(ConnectionEvent event) {
|
||||||
updateLastUsed();
|
updateLastUsed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void disconnection(DisconnectionEvent event) {
|
||||||
|
updateLastUsed();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -479,6 +479,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
|
|
||||||
public void updateTransaction(List<Payment> transactionPayments) {
|
public void updateTransaction(List<Payment> transactionPayments) {
|
||||||
if(walletTransactionService != null && walletTransactionService.isRunning()) {
|
if(walletTransactionService != null && walletTransactionService.isRunning()) {
|
||||||
|
walletTransactionService.setIgnoreResult(true);
|
||||||
walletTransactionService.cancel();
|
walletTransactionService.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,15 +496,19 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
|
|
||||||
walletTransactionService = new WalletTransactionService(wallet, getUtxoSelectors(), getUtxoFilters(), payments, feeRate, getMinimumFeeRate(), userFee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs);
|
walletTransactionService = new WalletTransactionService(wallet, getUtxoSelectors(), getUtxoFilters(), payments, feeRate, getMinimumFeeRate(), userFee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs);
|
||||||
walletTransactionService.setOnSucceeded(event -> {
|
walletTransactionService.setOnSucceeded(event -> {
|
||||||
|
if(!walletTransactionService.isIgnoreResult()) {
|
||||||
walletTransactionProperty.setValue(walletTransactionService.getValue());
|
walletTransactionProperty.setValue(walletTransactionService.getValue());
|
||||||
insufficientInputsProperty.set(false);
|
insufficientInputsProperty.set(false);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
walletTransactionService.setOnFailed(event -> {
|
walletTransactionService.setOnFailed(event -> {
|
||||||
|
if(!walletTransactionService.isIgnoreResult()) {
|
||||||
transactionDiagram.clear();
|
transactionDiagram.clear();
|
||||||
walletTransactionProperty.setValue(null);
|
walletTransactionProperty.setValue(null);
|
||||||
if(event.getSource().getException() instanceof InsufficientFundsException) {
|
if(event.getSource().getException() instanceof InsufficientFundsException) {
|
||||||
insufficientInputsProperty.set(true);
|
insufficientInputsProperty.set(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
final WalletTransactionService currentWalletTransactionService = walletTransactionService;
|
final WalletTransactionService currentWalletTransactionService = walletTransactionService;
|
||||||
|
@ -547,6 +552,7 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
private final boolean groupByAddress;
|
private final boolean groupByAddress;
|
||||||
private final boolean includeMempoolOutputs;
|
private final boolean includeMempoolOutputs;
|
||||||
private final boolean includeSpentMempoolOutputs;
|
private final boolean includeSpentMempoolOutputs;
|
||||||
|
private boolean ignoreResult;
|
||||||
|
|
||||||
public WalletTransactionService(Wallet wallet, List<UtxoSelector> utxoSelectors, List<UtxoFilter> utxoFilters, List<Payment> payments, double feeRate, double longTermFeeRate, Long fee, Integer currentBlockHeight, boolean groupByAddress, boolean includeMempoolOutputs, boolean includeSpentMempoolOutputs) {
|
public WalletTransactionService(Wallet wallet, List<UtxoSelector> utxoSelectors, List<UtxoFilter> utxoFilters, List<Payment> payments, double feeRate, double longTermFeeRate, Long fee, Integer currentBlockHeight, boolean groupByAddress, boolean includeMempoolOutputs, boolean includeSpentMempoolOutputs) {
|
||||||
this.wallet = wallet;
|
this.wallet = wallet;
|
||||||
|
@ -570,6 +576,14 @@ public class SendController extends WalletFormController implements Initializabl
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isIgnoreResult() {
|
||||||
|
return ignoreResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIgnoreResult(boolean ignoreResult) {
|
||||||
|
this.ignoreResult = ignoreResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<UtxoFilter> getUtxoFilters() {
|
private List<UtxoFilter> getUtxoFilters() {
|
||||||
|
|
Loading…
Reference in a new issue