remove warmup key derivation, indicate when creating wallet transaction is deriving keys

This commit is contained in:
Craig Raw 2022-07-14 16:09:22 +02:00
parent ac64811b35
commit ebbc4289e1
3 changed files with 9 additions and 27 deletions

2
drongo

@ -1 +1 @@
Subproject commit d489aa6af9e22e9b707570d9c19ab10aec0d0a28 Subproject commit fefebbabb5202330de028abe05344a91cf602018

View file

@ -1063,13 +1063,6 @@ public class AppServices {
if(Config.get().getServerType() == ServerType.BITCOIN_CORE) { if(Config.get().getServerType() == ServerType.BITCOIN_CORE) {
Platform.runLater(() -> restartBwt(event.getWallet())); 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 @Subscribe
@ -1109,22 +1102,4 @@ public class AppServices {
onlineProperty.set(true); onlineProperty.set(true);
} }
} }
private static final class WalletKeyDerivationService extends Service<Boolean> {
private final Wallet wallet;
public WalletKeyDerivationService(Wallet wallet) {
this.wallet = wallet;
}
@Override
protected Task<Boolean> createTask() {
return new Task<>() {
protected Boolean call() {
wallet.copy().derivePublicKeys();
return true;
}
};
}
}
} }

View file

@ -599,7 +599,12 @@ public class SendController extends WalletFormController implements Initializabl
final WalletTransactionService currentWalletTransactionService = walletTransactionService; final WalletTransactionService currentWalletTransactionService = walletTransactionService;
final KeyFrame delay = new KeyFrame(Duration.millis(200), e -> { final KeyFrame delay = new KeyFrame(Duration.millis(200), e -> {
if(currentWalletTransactionService.isRunning()) { 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); createButton.setDisable(true);
notificationButton.setDisable(true); notificationButton.setDisable(true);
} }
@ -677,8 +682,10 @@ public class SendController extends WalletFormController implements Initializabl
protected Task<WalletTransaction> createTask() { protected Task<WalletTransaction> createTask() {
return new Task<>() { return new Task<>() {
protected WalletTransaction call() throws InsufficientFundsException { protected WalletTransaction call() throws InsufficientFundsException {
updateMessage("Selecting UTXOs...");
WalletTransaction walletTransaction = wallet.createWalletTransaction(utxoSelectors, utxoFilters, payments, opReturns, excludedChangeNodes, WalletTransaction walletTransaction = wallet.createWalletTransaction(utxoSelectors, utxoFilters, payments, opReturns, excludedChangeNodes,
feeRate, longTermFeeRate, fee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs); feeRate, longTermFeeRate, fee, currentBlockHeight, groupByAddress, includeMempoolOutputs, includeSpentMempoolOutputs);
updateMessage("Deriving keys...");
walletTransaction.updateAddressNodeMap(addressNodeMap, walletTransaction.getWallet()); walletTransaction.updateAddressNodeMap(addressNodeMap, walletTransaction.getWallet());
return walletTransaction; return walletTransaction;
} }