diff options
author | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-08-26 02:34:55 +0200 |
---|---|---|
committer | Sebastian Falbesoner <sebastian.falbesoner@gmail.com> | 2022-10-25 15:57:38 +0200 |
commit | 845279132b494f03b84d689c666fdcfad37f5a42 (patch) | |
tree | b0b555f84f04e094678fec400db7e489db412931 /src | |
parent | 088e38d3bbea9694b319bc34e0d2e70d210c38b4 (diff) | |
download | bitcoin-845279132b494f03b84d689c666fdcfad37f5a42.tar.xz |
wallet: support fetching scriptPubKeys with minimum descriptor range index
This extra method will be needed for updating the filter set for
faster wallet rescans; after an internal top-up has happened, we only
want to add the newly created scriptPubKeys.
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/scriptpubkeyman.cpp | 9 | ||||
-rw-r--r-- | src/wallet/scriptpubkeyman.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp index 39afb79600..c432bfc221 100644 --- a/src/wallet/scriptpubkeyman.cpp +++ b/src/wallet/scriptpubkeyman.cpp @@ -2645,12 +2645,17 @@ const WalletDescriptor DescriptorScriptPubKeyMan::GetWalletDescriptor() const const std::unordered_set<CScript, SaltedSipHasher> DescriptorScriptPubKeyMan::GetScriptPubKeys() const { + return GetScriptPubKeys(0); +} + +const std::unordered_set<CScript, SaltedSipHasher> DescriptorScriptPubKeyMan::GetScriptPubKeys(int32_t minimum_index) const +{ LOCK(cs_desc_man); std::unordered_set<CScript, SaltedSipHasher> script_pub_keys; script_pub_keys.reserve(m_map_script_pub_keys.size()); - for (auto const& script_pub_key: m_map_script_pub_keys) { - script_pub_keys.insert(script_pub_key.first); + for (auto const& [script_pub_key, index] : m_map_script_pub_keys) { + if (index >= minimum_index) script_pub_keys.insert(script_pub_key); } return script_pub_keys; } diff --git a/src/wallet/scriptpubkeyman.h b/src/wallet/scriptpubkeyman.h index 3ab489c374..4ff7fdb154 100644 --- a/src/wallet/scriptpubkeyman.h +++ b/src/wallet/scriptpubkeyman.h @@ -643,6 +643,7 @@ public: const WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man); const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override; + const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys(int32_t minimum_index) const; bool GetDescriptorString(std::string& out, const bool priv) const; |