MCPcopy Create free account
hub / github.com/LUX-Core/lux / ScriptPubKeyToJSON

Function ScriptPubKeyToJSON

src/rpcrawtransaction.cpp:38–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 4

gettxoutFunction · 0.85
rest_getutxosFunction · 0.85
TxToJSONFunction · 0.85
decodescriptFunction · 0.85

Calls 9

PairFunction · 0.85
HexStrFunction · 0.85
ExtractDestinationsFunction · 0.85
GetTxnOutputTypeFunction · 0.85
EncodeDestinationFunction · 0.85
push_backMethod · 0.45
ToStringMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected