MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / IsInternalScriptPubKeyMan

Method IsInternalScriptPubKeyMan

src/wallet/wallet.cpp:3773–3790  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3771}
3772
3773std::optional<bool> CWallet::IsInternalScriptPubKeyMan(ScriptPubKeyMan* spk_man) const
3774{
3775 // only active ScriptPubKeyMan can be internal
3776 if (!GetActiveScriptPubKeyMans().contains(spk_man)) {
3777 return std::nullopt;
3778 }
3779
3780 const auto desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man);
3781 if (!desc_spk_man) {
3782 throw std::runtime_error(std::string(__func__) + ": unexpected ScriptPubKeyMan type.");
3783 }
3784
3785 LOCK(desc_spk_man->cs_desc_man);
3786 const auto& type = desc_spk_man->GetWalletDescriptor().descriptor->GetOutputType();
3787 assert(type.has_value());
3788
3789 return GetScriptPubKeyMan(*type, /* internal= */ true) == desc_spk_man;
3790}
3791
3792util::Result<std::reference_wrapper<DescriptorScriptPubKeyMan>> CWallet::AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label, bool internal)
3793{

Callers 1

ExportDescriptorsFunction · 0.80

Calls 4

GetWalletDescriptorMethod · 0.80
containsMethod · 0.45
GetOutputTypeMethod · 0.45
has_valueMethod · 0.45

Tested by

no test coverage detected