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

Function ScriptPubKeyToUniv

src/core_write.cpp:164–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

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