MCPcopy Create free account
hub / github.com/ElementsProject/elements / IsInternalScriptPubKeyMan

Method IsInternalScriptPubKeyMan

src/wallet/wallet.cpp:3806–3828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3804}
3805
3806std::optional<bool> CWallet::IsInternalScriptPubKeyMan(ScriptPubKeyMan* spk_man) const
3807{
3808 // Legacy script pubkey man can't be either external or internal
3809 if (IsLegacy()) {
3810 return std::nullopt;
3811 }
3812
3813 // only active ScriptPubKeyMan can be internal
3814 if (!GetActiveScriptPubKeyMans().count(spk_man)) {
3815 return std::nullopt;
3816 }
3817
3818 const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man);
3819 if (!desc_spk_man) {
3820 throw std::runtime_error(std::string(__func__) + ": unexpected ScriptPubKeyMan type.");
3821 }
3822
3823 LOCK(desc_spk_man->cs_desc_man);
3824 const auto& type = desc_spk_man->GetWalletDescriptor().descriptor->GetOutputType();
3825 assert(type.has_value());
3826
3827 return GetScriptPubKeyMan(*type, /* internal= */ true) == desc_spk_man;
3828}
3829
3830ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label, bool internal)
3831{

Callers 1

listdescriptorsFunction · 0.80

Calls 3

countMethod · 0.80
GetWalletDescriptorMethod · 0.80
GetOutputTypeMethod · 0.45

Tested by

no test coverage detected