diff options
author | Pieter Wuille <pieter@wuille.net> | 2021-06-06 00:05:02 -0700 |
---|---|---|
committer | Pieter Wuille <pieter@wuille.net> | 2021-06-18 11:23:17 -0700 |
commit | c7388e5ada394b7fe94d6263fb02e9dd28ab367e (patch) | |
tree | 6b370f464ef177ff7f9618d5b553df40201d1a29 /src | |
parent | 29e5dd1a5b9a1879e6c3c7e153b2e6f33a79e905 (diff) |
Report address as solvable based on inferred descriptor
Diffstat (limited to 'src')
-rw-r--r-- | src/wallet/rpcwallet.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ab34af2329..94915a1373 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3848,13 +3848,18 @@ RPCHelpMan getaddressinfo() isminetype mine = pwallet->IsMine(dest); ret.pushKV("ismine", bool(mine & ISMINE_SPENDABLE)); - bool solvable = provider && IsSolvable(*provider, scriptPubKey); - ret.pushKV("solvable", solvable); - - if (solvable) { - ret.pushKV("desc", InferDescriptor(scriptPubKey, *provider)->ToString()); + if (provider) { + auto inferred = InferDescriptor(scriptPubKey, *provider); + bool solvable = inferred->IsSolvable() || IsSolvable(*provider, scriptPubKey); + ret.pushKV("solvable", solvable); + if (solvable) { + ret.pushKV("desc", inferred->ToString()); + } + } else { + ret.pushKV("solvable", false); } + DescriptorScriptPubKeyMan* desc_spk_man = dynamic_cast<DescriptorScriptPubKeyMan*>(pwallet->GetScriptPubKeyMan(scriptPubKey)); if (desc_spk_man) { std::string desc_str; |