wallet: allow to fetch the wallet descriptors for a given Script
We currently expose a method to get the signing providers, which allows to infer a descriptor from the scriptPubKey. But in order to identify "on" what descriptor a coin was received, we need access to the descriptors that were imported to the wallet.
This commit is contained in:
2 files changed
+15
No files matched your search
@@ -3311,6 +3311,18 @@ std::unique_ptr<SigningProvider> CWallet::GetSolvingProvider(const CScript& scri
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<WalletDescriptor> CWallet::GetWalletDescriptors(const CScript& script) const
|
||||||
|
{
|
||||||
|
std::vector<WalletDescriptor> descs;
|
||||||
|
for (const auto spk_man: GetScriptPubKeyMans(script)) {
|
||||||
|
if (const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man)) {
|
||||||
|
LOCK(desc_spk_man->cs_desc_man);
|
||||||
|
descs.push_back(desc_spk_man->GetWalletDescriptor());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return descs;
|
||||||
|
}
|
||||||
|
|
||||||
LegacyScriptPubKeyMan* CWallet::GetLegacyScriptPubKeyMan() const
|
LegacyScriptPubKeyMan* CWallet::GetLegacyScriptPubKeyMan() const
|
||||||
{
|
{
|
||||||
if (IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
|
if (IsWalletFlagSet(WALLET_FLAG_DESCRIPTORS)) {
|
||||||
|
|||||||
@@ -839,6 +839,9 @@ public:
|
|||||||
std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const;
|
std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script) const;
|
||||||
std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script, SignatureData& sigdata) const;
|
std::unique_ptr<SigningProvider> GetSolvingProvider(const CScript& script, SignatureData& sigdata) const;
|
||||||
|
|
||||||
|
//! Get the wallet descriptors for a script.
|
||||||
|
std::vector<WalletDescriptor> GetWalletDescriptors(const CScript& script) const;
|
||||||
|
|
||||||
//! Get the LegacyScriptPubKeyMan which is used for all types, internal, and external.
|
//! Get the LegacyScriptPubKeyMan which is used for all types, internal, and external.
|
||||||
LegacyScriptPubKeyMan* GetLegacyScriptPubKeyMan() const;
|
LegacyScriptPubKeyMan* GetLegacyScriptPubKeyMan() const;
|
||||||
LegacyScriptPubKeyMan* GetOrCreateLegacyScriptPubKeyMan();
|
LegacyScriptPubKeyMan* GetOrCreateLegacyScriptPubKeyMan();
|
||||||
|
|||||||
Reference in new issue
Block a user