Skip to content

Commit bbe4a36

Browse files
committed
wallet: Add GetDescriptorString to DescriptorScriptPubKeyMan
GetDescriptorString returns a normalized descriptor for a DescriptorScriptPubKeyMan.
1 parent 9be1437 commit bbe4a36

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/wallet/scriptpubkeyman.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,3 +2254,16 @@ const std::vector<CScript> DescriptorScriptPubKeyMan::GetScriptPubKeys() const
22542254
}
22552255
return script_pub_keys;
22562256
}
2257+
2258+
bool DescriptorScriptPubKeyMan::GetDescriptorString(std::string& out, bool priv) const
2259+
{
2260+
LOCK(cs_desc_man);
2261+
if (m_storage.IsLocked()) {
2262+
return false;
2263+
}
2264+
2265+
FlatSigningProvider provider;
2266+
provider.keys = GetKeys();
2267+
2268+
return m_wallet_descriptor.descriptor->ToNormalizedString(provider, out, priv);
2269+
}

src/wallet/scriptpubkeyman.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ class DescriptorScriptPubKeyMan : public ScriptPubKeyMan
615615

616616
const WalletDescriptor GetWalletDescriptor() const EXCLUSIVE_LOCKS_REQUIRED(cs_desc_man);
617617
const std::vector<CScript> GetScriptPubKeys() const;
618+
619+
bool GetDescriptorString(std::string& out, bool priv) const;
618620
};
619621

620622
#endif // BITCOIN_WALLET_SCRIPTPUBKEYMAN_H

0 commit comments

Comments
 (0)