From ebbc4289e15ba7573875699c21ed70049501c8c6 Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 14 Jul 2022 16:09:22 +0200 Subject: [PATCH] remove warmup key derivation, indicate when creating wallet transaction is deriving keys --- drongo | 2 +- .../sparrowwallet/sparrow/AppServices.java | 25 ------------------- .../sparrow/wallet/SendController.java | 9 ++++++- 3 files changed, 9 insertions(+), 27 deletions(-) diff --git a/drongo b/drongo index d489aa6a..fefebbab 160000 --- a/drongo +++ b/drongo @@ -1 +1 @@ -Subproject commit d489aa6af9e22e9b707570d9c19ab10aec0d0a28 +Subproject commit fefebbabb5202330de028abe05344a91cf602018 diff --git a/src/main/java/com/sparrowwallet/sparrow/AppServices.java b/src/main/java/com/sparrowwallet/sparrow/AppServices.java index 72924149..d6281e77 100644 --- a/src/main/java/com/sparrowwallet/sparrow/AppServices.java +++ b/src/main/java/com/sparrowwallet/sparrow/AppServices.java @@ -1063,13 +1063,6 @@ public class AppServices { if(Config.get().getServerType() == ServerType.BITCOIN_CORE) { Platform.runLater(() -> restartBwt(event.getWallet())); } - - //Ensure public key cache is warm - WalletKeyDerivationService walletKeyDerivationService = new WalletKeyDerivationService(event.getWallet()); - walletKeyDerivationService.setOnFailed(workerStateEvent -> { - log.error("Error deriving public keys", workerStateEvent.getSource().getException()); - }); - walletKeyDerivationService.start(); } @Subscribe @@ -1109,22 +1102,4 @@ public class AppServices { onlineProperty.set(true); } } - - private static final class WalletKeyDerivationService extends Service { - private final Wallet wallet; - - public WalletKeyDerivationService(Wallet wallet) { - this.wallet = wallet; - } - - @Override - protected Task createTask() { - return new Task<>() { - protected Boolean call() { - wallet.copy().derivePublicKeys(); - return true; - } - }; - } - } } diff --git a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java index 7df5c784..7fe36ac6 100644 --- a/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java +++ b/src/main/java/com/sparrowwallet/sparrow/wallet/SendController.java @@ -599,7 +599,12 @@ public class SendController extends WalletFormController implements Initializabl final WalletTransactionService currentWalletTransactionService = walletTransactionService; final KeyFrame delay = new KeyFrame(Duration.millis(200), e -> { if(currentWalletTransactionService.isRunning()) { - transactionDiagram.update("Selecting UTXOs..."); + transactionDiagram.update(currentWalletTransactionService.getMessage()); + currentWalletTransactionService.messageProperty().addListener((observable1, oldValue, newValue) -> { + if(currentWalletTransactionService.isRunning()) { + transactionDiagram.update(newValue); + } + }); createButton.setDisable(true); notificationButton.setDisable(true); } @@ -677,8 +682,10 @@ public class SendController extends WalletFormController implements Initializabl protected Task createTask() { return new Task<>() { protected WalletTransaction call() throws InsufficientFundsException { + updateMessage("Selecting UTXOs..."); WalletTransaction walletTransaction = wallet.createWalletTransaction(utxoSelectors, utxoFilters, payments, opReturns, excludedChangeNodes, feeRate, longTermFeeRate, fee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs); + updateMessage("Deriving keys..."); walletTransaction.updateAddressNodeMap(addressNodeMap, walletTransaction.getWallet()); return walletTransaction; }