| 162 | } |
| 163 | |
| 164 | void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex) |
| 165 | { |
| 166 | txnouttype type; |
| 167 | vector<CTxDestination> addresses; |
| 168 | int nRequired; |
| 169 | const uint32_t flags = STANDARD_SCRIPT_VERIFY_FLAGS | SCRIPT_ENABLE_P2SH_32; |
| 170 | |
| 171 | out.pushKV("asm", ScriptToAsmStr(scriptPubKey)); |
| 172 | if (fIncludeHex) |
| 173 | out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())); |
| 174 | |
| 175 | if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired, flags)) |
| 176 | { |
| 177 | out.pushKV("type", GetTxnOutputType(type)); |
| 178 | return; |
| 179 | } |
| 180 | |
| 181 | out.pushKV("reqSigs", nRequired); |
| 182 | out.pushKV("type", GetTxnOutputType(type)); |
| 183 | |
| 184 | UniValue a(UniValue::VARR); |
| 185 | for (const CTxDestination &addr : addresses) |
| 186 | { |
| 187 | a.push_back(EncodeDestination(addr)); |
| 188 | } |
| 189 | out.pushKV("addresses", a); |
| 190 | } |
| 191 | |
| 192 | void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry) |
| 193 | { |
no test coverage detected