Skip to content

Commit 8452791

Browse files
committed
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.
1 parent 088e38d commit 8452791

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2644,13 +2644,18 @@ const WalletDescriptor DescriptorScriptPubKeyMan::GetWalletDescriptor() const
26442644
}
26452645

26462646
const std::unordered_set<CScript, SaltedSipHasher> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
2647+
{
2648+
return GetScriptPubKeys(0);
2649+
}
2650+
2651+
const std::unordered_set<CScript, SaltedSipHasher> DescriptorScriptPubKeyMan::GetScriptPubKeys(int32_t minimum_index) const
26472652
{
26482653
LOCK(cs_desc_man);
26492654
std::unordered_set<CScript, SaltedSipHasher> script_pub_keys;
26502655
script_pub_keys.reserve(m_map_script_pub_keys.size());
26512656

2652-
for (auto const& script_pub_key: m_map_script_pub_keys) {
2653-
script_pub_keys.insert(script_pub_key.first);
2657+
for (auto const& [script_pub_key, index] : m_map_script_pub_keys) {
2658+
if (index >= minimum_index) script_pub_keys.insert(script_pub_key);
26542659
}
26552660
return script_pub_keys;
26562661
}

src/wallet/scriptpubkeyman.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
643643

644644
const WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
645645
const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys() const override;
646+
const std::unordered_set<CScript, SaltedSipHasher> GetScriptPubKeys(int32_t minimum_index) const;
646647

647648
bool GetDescriptorString(std::string& out, const bool priv) const;
648649

0 commit comments

Comments
 (0)