| 3804 | } |
| 3805 | |
| 3806 | std::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 | |
| 3830 | ScriptPubKeyMan* CWallet::AddWalletDescriptor(WalletDescriptor& desc, const FlatSigningProvider& signing_provider, const std::string& label, bool internal) |
| 3831 | { |
no test coverage detected