From bd01cb87309bcc4a4739b63a6d7548ca1b25910e Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Thu, 14 Jul 2022 09:55:46 +0200 Subject: [PATCH] add method to warm the pubkey cache --- .../java/com/sparrowwallet/drongo/wallet/Wallet.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java index d69755f..a034dce 100644 --- a/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java +++ b/src/main/java/com/sparrowwallet/drongo/wallet/Wallet.java @@ -740,6 +740,17 @@ public class Wallet extends Persistable implements Comparable { } } + public void derivePublicKeys() { + for(KeyPurpose keyPurpose : KeyPurpose.DEFAULT_PURPOSES) { + WalletNode purposeNode = getNode(keyPurpose); + for(WalletNode addressNode : purposeNode.getChildren()) { + for(Keystore keystore : getKeystores()) { + keystore.getPubKey(addressNode); + } + } + } + } + public boolean isWalletTxo(TransactionInput txInput) { return getWalletTxos().keySet().stream().anyMatch(ref -> ref.getHash().equals(txInput.getOutpoint().getHash()) && ref.getIndex() == txInput.getOutpoint().getIndex()); }