aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.h
diff options
context:
space:
mode:
authorAndrew Chow <achow101-github@achow101.com>2022-03-28 16:47:59 -0400
committerAndrew Chow <achow101-github@achow101.com>2022-08-03 15:33:13 -0400
commit1f798fe85ba952273005f68e36ed48cfc36f4c9d (patch)
tree4539e195c713cedb0266a3e1a0ddfe5e4c61480f /src/wallet/scriptpubkeyman.h
parent8a105ecd1aeff15f84c3883e2762bf71ad59d920 (diff)
downloadbitcoin-1f798fe85ba952273005f68e36ed48cfc36f4c9d.tar.xz
wallet: Cache SigningProviders
In order to avoid constantly re-deriving the same keys in DescriptorScriptPubKeyMan, cache the SigningProviders generated inside of GetSigningProvider.
Diffstat (limited to 'src/wallet/scriptpubkeyman.h')
-rw-r--r--src/wallet/scriptpubkeyman.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h
index eebc05330f..d0af09463b 100644
--- a/src/wallet/scriptpubkeyman.h
+++ b/src/wallet/scriptpubkeyman.h
@@ -547,6 +547,8 @@ private:
KeyMap GetKeys() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
+ // Cached FlatSigningProviders to avoid regenerating them each time they are needed.
+ mutable std::map<int32_t, FlatSigningProvider> m_map_signing_providers;
// Fetch the SigningProvider for the given script and optionally include private keys
std::unique_ptr<FlatSigningProvider> GetSigningProvider(const CScript& script, bool include_private = false) const;
// Fetch the SigningProvider for the given pubkey and always include private keys. This should only be called by signing code.