mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
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.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user