add method to warm the pubkey cache

This commit is contained in:
Craig Raw 2022-07-14 09:55:46 +02:00
parent cd1e21ebaa
commit bd01cb8730

View file

@ -740,6 +740,17 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
} }
} }
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) { public boolean isWalletTxo(TransactionInput txInput) {
return getWalletTxos().keySet().stream().anyMatch(ref -> ref.getHash().equals(txInput.getOutpoint().getHash()) && ref.getIndex() == txInput.getOutpoint().getIndex()); return getWalletTxos().keySet().stream().anyMatch(ref -> ref.getHash().equals(txInput.getOutpoint().getHash()) && ref.getIndex() == txInput.getOutpoint().getIndex());
} }