aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/scriptpubkeyman.cpp
diff options
context:
space:
mode:
authorfurszy <matiasfurszyfer@protonmail.com>2023-06-23 11:32:28 -0300
committerfurszy <matiasfurszyfer@protonmail.com>2023-06-28 09:37:15 -0300
commit97a965d98f1582ea1b1377bd258c9088380e1b8b (patch)
treed9c6b1fbbc9bef4c91cd394a75092f48a6774ffa /src/wallet/scriptpubkeyman.cpp
parent1d207e3931cf076f69d4a8335cdd6c8ebb2a963f (diff)
downloadbitcoin-97a965d98f1582ea1b1377bd258c9088380e1b8b.tar.xz
refactor: extract descriptor ID calculation from spkm GetID()
This allows us to verify the descriptor ID on the descriptors unit tests in different software versions without requiring to use the entire DescriptorScriptPubKeyMan machinery. Note: The unit test changes are introduced after the bugfix commit but this commit + the unit test commit can be cherry-picked on top of the v25 branch to verify IDs correctness. IDs must be the same for v25 and after the bugfix commit.
Diffstat (limited to 'src/wallet/scriptpubkeyman.cpp')
-rw-r--r--src/wallet/scriptpubkeyman.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/wallet/scriptpubkeyman.cpp b/src/wallet/scriptpubkeyman.cpp
index 796b7f11c5..5b110b4d14 100644
--- a/src/wallet/scriptpubkeyman.cpp
+++ b/src/wallet/scriptpubkeyman.cpp
@@ -2584,10 +2584,7 @@ std::unique_ptr<CKeyMetadata> DescriptorScriptPubKeyMan::GetMetadata(const CTxDe
uint256 DescriptorScriptPubKeyMan::GetID() const
{
LOCK(cs_desc_man);
- std::string desc_str = m_wallet_descriptor.descriptor->ToString();
- uint256 id;
- CSHA256().Write((unsigned char*)desc_str.data(), desc_str.size()).Finalize(id.begin());
- return id;
+ return DescriptorID(*m_wallet_descriptor.descriptor);
}
void DescriptorScriptPubKeyMan::SetCache(const DescriptorCache& cache)