MCPcopy Create free account
hub / github.com/bitcoinxt/bitcoinxt / ScriptPubKeyToUniv

Function ScriptPubKeyToUniv

src/core_write.cpp:140–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void ScriptPubKeyToUniv(const CScript& scriptPubKey,
141 UniValue& out, bool fIncludeHex)
142{
143 txnouttype type;
144 vector<CTxDestination> addresses;
145 int nRequired;
146
147 out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
148 if (fIncludeHex)
149 out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
150
151 if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
152 out.pushKV("type", GetTxnOutputType(type));
153 return;
154 }
155
156 out.pushKV("reqSigs", nRequired);
157 out.pushKV("type", GetTxnOutputType(type));
158
159 UniValue a(UniValue::VARR);
160 BOOST_FOREACH(const CTxDestination& addr, addresses)
161 a.push_back(CBitcoinAddress(addr).ToString());
162 out.pushKV("addresses", a);
163}
164
165void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry)
166{

Callers 1

TxToUnivFunction · 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