Changeset View
Changeset View
Standalone View
Standalone View
src/core_write.cpp
Show First 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | std::string EncodeHexTx(const CTransaction &tx, const int serializeFlags) { | ||||
return HexStr(ssTx); | return HexStr(ssTx); | ||||
} | } | ||||
void ScriptToUniv(const CScript &script, UniValue &out, bool include_address) { | void ScriptToUniv(const CScript &script, UniValue &out, bool include_address) { | ||||
out.pushKV("asm", ScriptToAsmStr(script)); | out.pushKV("asm", ScriptToAsmStr(script)); | ||||
out.pushKV("hex", HexStr(script)); | out.pushKV("hex", HexStr(script)); | ||||
std::vector<std::vector<uint8_t>> solns; | std::vector<std::vector<uint8_t>> solns; | ||||
txnouttype type = Solver(script, solns); | TxoutType type = Solver(script, solns); | ||||
out.pushKV("type", GetTxnOutputType(type)); | out.pushKV("type", GetTxnOutputType(type)); | ||||
CTxDestination address; | CTxDestination address; | ||||
if (include_address && ExtractDestination(script, address) && | if (include_address && ExtractDestination(script, address) && | ||||
type != TX_PUBKEY) { | type != TxoutType::PUBKEY) { | ||||
out.pushKV("address", EncodeDestination(address, GetConfig())); | out.pushKV("address", EncodeDestination(address, GetConfig())); | ||||
} | } | ||||
} | } | ||||
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, | void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, | ||||
bool fIncludeHex) { | bool fIncludeHex) { | ||||
txnouttype type; | TxoutType type; | ||||
std::vector<CTxDestination> addresses; | std::vector<CTxDestination> addresses; | ||||
int nRequired; | int nRequired; | ||||
out.pushKV("asm", ScriptToAsmStr(scriptPubKey)); | out.pushKV("asm", ScriptToAsmStr(scriptPubKey)); | ||||
if (fIncludeHex) { | if (fIncludeHex) { | ||||
out.pushKV("hex", HexStr(scriptPubKey)); | out.pushKV("hex", HexStr(scriptPubKey)); | ||||
} | } | ||||
if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || | if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired) || | ||||
type == TX_PUBKEY) { | type == TxoutType::PUBKEY) { | ||||
out.pushKV("type", GetTxnOutputType(type)); | out.pushKV("type", GetTxnOutputType(type)); | ||||
return; | return; | ||||
} | } | ||||
out.pushKV("reqSigs", nRequired); | out.pushKV("reqSigs", nRequired); | ||||
out.pushKV("type", GetTxnOutputType(type)); | out.pushKV("type", GetTxnOutputType(type)); | ||||
UniValue a(UniValue::VARR); | UniValue a(UniValue::VARR); | ||||
▲ Show 20 Lines • Show All 62 Lines • Show Last 20 Lines |