MCPcopy Create free account
hub / github.com/dogecoin/dogecoin / ScriptPubKeyToJSON

Function ScriptPubKeyToJSON

src/rpc/rawtransaction.cpp:39–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37using namespace std;
38
39void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
40{
41 txnouttype type;
42 vector<CTxDestination> addresses;
43 int nRequired;
44
45 out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
46 if (fIncludeHex)
47 out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
48
49 if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
50 out.pushKV("type", GetTxnOutputType(type));
51 return;
52 }
53
54 out.pushKV("reqSigs", nRequired);
55 out.pushKV("type", GetTxnOutputType(type));
56
57 UniValue a(UniValue::VARR);
58 BOOST_FOREACH(const CTxDestination& addr, addresses)
59 a.push_back(CBitcoinAddress(addr).ToString());
60 out.pushKV("addresses", a);
61}
62
63void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
64{

Callers 4

BOOST_FOREACHFunction · 0.85
TxToJSONFunction · 0.85
decodescriptFunction · 0.85
gettxoutFunction · 0.85

Calls 10

ScriptToAsmStrFunction · 0.85
HexStrFunction · 0.85
ExtractDestinationsFunction · 0.85
GetTxnOutputTypeFunction · 0.85
CBitcoinAddressClass · 0.85
pushKVMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected