aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 8cb2c46b63..77b3cfe4dc 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3940,8 +3940,12 @@ RPCHelpMan getaddressinfo()
ret.pushKV("solvable", false);
}
+ const auto& spk_mans = pwallet->GetScriptPubKeyMans(scriptPubKey);
+ // In most cases there is only one matching ScriptPubKey manager and we can't resolve ambiguity in a better way
+ ScriptPubKeyMan* spk_man{nullptr};
+ if (spk_mans.size()) spk_man = *spk_mans.begin();
- DescriptorScriptPubKeyMan* desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(pwallet->GetScriptPubKeyMan(scriptPubKey));
+ DescriptorScriptPubKeyMan* desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(spk_man);
if (desc_spk_man) {
std::string desc_str;
if (desc_spk_man->GetDescriptorString(desc_str, /* priv */ false)) {
@@ -3956,7 +3960,6 @@ RPCHelpMan getaddressinfo()
ret.pushKV("ischange", ScriptIsChange(*pwallet, scriptPubKey));
- ScriptPubKeyMan* spk_man = pwallet->GetScriptPubKeyMan(scriptPubKey);
if (spk_man) {
if (const std::unique_ptr<CKeyMetadata> meta = spk_man->GetMetadata(dest)) {
ret.pushKV("timestamp", meta->nCreateTime);