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

Function ScriptPubKeyToUniv

src/core_write.cpp:160–184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void ScriptPubKeyToUniv(const CScript& scriptPubKey,
161 UniValue& out, bool fIncludeHex)
162{
163 txnouttype type;
164 std::vector<CTxDestination> addresses;
165 int nRequired;
166
167 out.pushKV("asm", ScriptToAsmStr(scriptPubKey));
168 if (fIncludeHex)
169 out.pushKV("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end()));
170
171 if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
172 out.pushKV("type", GetTxnOutputType(type));
173 return;
174 }
175
176 out.pushKV("reqSigs", nRequired);
177 out.pushKV("type", GetTxnOutputType(type));
178
179 UniValue a(UniValue::VARR);
180 for (const CTxDestination& addr : addresses) {
181 a.push_back(EncodeDestination(addr));
182 }
183 out.pushKV("addresses", a);
184}
185
186void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, bool include_hex, int serialize_flags)
187{

Callers 4

TxToUnivFunction · 0.85
rest_getutxosFunction · 0.85
decodescriptFunction · 0.85
gettxoutFunction · 0.85

Calls 9

ScriptToAsmStrFunction · 0.85
HexStrFunction · 0.85
ExtractDestinationsFunction · 0.85
GetTxnOutputTypeFunction · 0.85
EncodeDestinationFunction · 0.85
pushKVMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected