MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / ScriptToUniv

Function ScriptToUniv

src/core_io.cpp:407–426  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

405}
406
407void ScriptToUniv(const CScript& script, UniValue& out, bool include_hex, bool include_address, const SigningProvider* provider)
408{
409 CTxDestination address;
410
411 out.pushKV("asm", ScriptToAsmStr(script));
412 if (include_address) {
413 out.pushKV("desc", InferDescriptor(script, provider ? *provider : DUMMY_SIGNING_PROVIDER)->ToString());
414 }
415 if (include_hex) {
416 out.pushKV("hex", HexStr(script));
417 }
418
419 std::vector<std::vector<unsigned char>> solns;
420 const TxoutType type{Solver(script, solns)};
421
422 if (include_address && ExtractDestination(script, address) && type != TxoutType::PUBKEY) {
423 out.pushKV("address", EncodeDestination(address));
424 }
425 out.pushKV("type", GetTxnOutputType(type));
426}
427
428void TxToUniv(const CTransaction& tx, const uint256& block_hash, UniValue& entry, bool include_hex, const CTxUndo* txundo, TxVerbosity verbosity, std::function<bool(const CTxOut&)> is_change_func)
429{

Callers 8

BlockUndoToJSONFunction · 0.85
rest_getutxosFunction · 0.85
TxToUnivFunction · 0.85
script_format.cppFile · 0.85
decodescriptFunction · 0.85
decodepsbtFunction · 0.85
gettxoutFunction · 0.85
getdescriptoractivityFunction · 0.85

Calls 9

ScriptToAsmStrFunction · 0.85
InferDescriptorFunction · 0.85
SolverFunction · 0.85
ExtractDestinationFunction · 0.85
EncodeDestinationFunction · 0.85
GetTxnOutputTypeFunction · 0.85
pushKVMethod · 0.80
HexStrFunction · 0.50
ToStringMethod · 0.45

Tested by

no test coverage detected