MCPcopy Create free account
hub / github.com/Bitcoin-ABC/bitcoin-abc / ScriptPubKeyToUniv

Function ScriptPubKeyToUniv

src/core_write.cpp:194–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192}
193
194void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out,
195 bool fIncludeHex) {
196 TxoutType type;
197 std::vector<CTxDestination> addresses;
198 int nRequired;
199
200 out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
201 if (fIncludeHex) {
202 out.pushKV("hex", HexStr(scriptPubKey));
203 }
204
205 if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) ||
206 type == TxoutType::PUBKEY) {
207 out.pushKV("type", GetTxnOutputType(type));
208 return;
209 }
210
211 out.pushKV("reqSigs", nRequired);
212 out.pushKV("type", GetTxnOutputType(type));
213
214 UniValue a(UniValue::VARR);
215 for (const CTxDestination &addr : addresses) {
216 a.push_back(EncodeDestination(addr, GetConfig()));
217 }
218 out.pushKV("addresses", a);
219}
220
221void TxToUniv(const CTransaction &tx, const BlockHash &hashBlock,
222 UniValue &entry, bool include_hex, const CTxUndo *txundo,

Callers 9

TxToUnivFunction · 0.85
rest_getutxosFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85
getblocktemplateFunction · 0.85
decodescriptFunction · 0.85
decodeavalancheproofFunction · 0.85
getstakingrewardFunction · 0.85
getflakyproofsFunction · 0.85
gettxoutFunction · 0.85

Calls 7

ScriptToAsmStrFunction · 0.85
ExtractDestinationsFunction · 0.85
GetTxnOutputTypeFunction · 0.85
EncodeDestinationFunction · 0.85
pushKVMethod · 0.80
HexStrFunction · 0.50
push_backMethod · 0.45

Tested by 1

FUZZ_TARGET_INITFunction · 0.68