Changeset View
Changeset View
Standalone View
Standalone View
src/core_write.cpp
Show First 20 Lines • Show All 178 Lines • ▼ Show 20 Lines | void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, | ||||
UniValue a(UniValue::VARR); | UniValue a(UniValue::VARR); | ||||
for (const CTxDestination &addr : addresses) { | for (const CTxDestination &addr : addresses) { | ||||
a.push_back(EncodeDestination(addr)); | a.push_back(EncodeDestination(addr)); | ||||
} | } | ||||
out.pushKV("addresses", a); | out.pushKV("addresses", a); | ||||
} | } | ||||
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, | void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, | ||||
UniValue &entry) { | bool include_hex, int serialize_flags) { | ||||
entry.pushKV("txid", tx.GetId().GetHex()); | entry.pushKV("txid", tx.GetId().GetHex()); | ||||
entry.pushKV("hash", tx.GetHash().GetHex()); | entry.pushKV("hash", tx.GetHash().GetHex()); | ||||
entry.pushKV("version", tx.nVersion); | entry.pushKV("version", tx.nVersion); | ||||
entry.pushKV("size", | entry.pushKV("size", | ||||
(int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION)); | (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION)); | ||||
entry.pushKV("locktime", (int64_t)tx.nLockTime); | entry.pushKV("locktime", (int64_t)tx.nLockTime); | ||||
UniValue vin(UniValue::VARR); | UniValue vin(UniValue::VARR); | ||||
Show All 36 Lines | void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, | ||||
} | } | ||||
entry.pushKV("vout", vout); | entry.pushKV("vout", vout); | ||||
if (!hashBlock.IsNull()) { | if (!hashBlock.IsNull()) { | ||||
entry.pushKV("blockhash", hashBlock.GetHex()); | entry.pushKV("blockhash", hashBlock.GetHex()); | ||||
} | } | ||||
// the hex-encoded transaction. used the name "hex" to be consistent with | if (include_hex) { | ||||
// the verbose output of "getrawtransaction". | // the hex-encoded transaction. used the name "hex" to be consistent | ||||
entry.pushKV("hex", EncodeHexTx(tx)); | // with the verbose output of "getrawtransaction". | ||||
entry.pushKV("hex", EncodeHexTx(tx, serialize_flags)); | |||||
} | |||||
} | } |