NOLINTNEXTLINE(misc-no-recursion)
| 264 | |
| 265 | // NOLINTNEXTLINE(misc-no-recursion) |
| 266 | void ProcessSubScript(const CScript& subscript, UniValue& obj) const |
| 267 | { |
| 268 | // Always present: script type and redeemscript |
| 269 | std::vector<std::vector<unsigned char>> solutions_data; |
| 270 | TxoutType which_type = Solver(subscript, solutions_data); |
| 271 | obj.pushKV("script", GetTxnOutputType(which_type)); |
| 272 | obj.pushKV("hex", HexStr(subscript)); |
| 273 | |
| 274 | CTxDestination embedded; |
| 275 | if (ExtractDestination(subscript, embedded)) { |
| 276 | // Only when the script corresponds to an address. |
| 277 | UniValue subobj(UniValue::VOBJ); |
| 278 | UniValue detail = DescribeAddress(embedded); |
| 279 | subobj.pushKVs(std::move(detail)); |
| 280 | UniValue wallet_detail = std::visit(*this, embedded); |
| 281 | subobj.pushKVs(std::move(wallet_detail)); |
| 282 | subobj.pushKV("address", EncodeDestination(embedded)); |
| 283 | subobj.pushKV("scriptPubKey", HexStr(subscript)); |
| 284 | // Always report the pubkey at the top level, so that `getnewaddress()['pubkey']` always works. |
| 285 | if (subobj.exists("pubkey")) obj.pushKV("pubkey", subobj["pubkey"]); |
| 286 | obj.pushKV("embedded", std::move(subobj)); |
| 287 | } else if (which_type == TxoutType::MULTISIG) { |
| 288 | // Also report some information on multisig scripts (which do not have a corresponding address). |
| 289 | obj.pushKV("sigsrequired", solutions_data[0][0]); |
| 290 | UniValue pubkeys(UniValue::VARR); |
| 291 | for (size_t i = 1; i < solutions_data.size() - 1; ++i) { |
| 292 | CPubKey key(solutions_data[i].begin(), solutions_data[i].end()); |
| 293 | pubkeys.push_back(HexStr(key)); |
| 294 | } |
| 295 | obj.pushKV("pubkeys", std::move(pubkeys)); |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | explicit DescribeWalletAddressVisitor(const SigningProvider* _provider) : provider(_provider) {} |
| 300 |
nothing calls this directly
no test coverage detected