Changeset View
Changeset View
Standalone View
Standalone View
src/core_write.cpp
Show First 20 Lines • Show All 210 Lines • ▼ Show 20 Lines | void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, | ||||
} | } | ||||
out.pushKV("addresses", a); | out.pushKV("addresses", a); | ||||
} | } | ||||
void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, | void TxToUniv(const CTransaction &tx, const uint256 &hashBlock, UniValue &entry, | ||||
bool include_hex, int serialize_flags) { | 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); | // Transaction version is actually unsigned in consensus checks, just | ||||
// signed in memory, so cast to unsigned before giving it to the user. | |||||
entry.pushKV("version", | |||||
static_cast<int64_t>(static_cast<uint32_t>(tx.nVersion))); | |||||
entry.pushKV("size", (int)::GetSerializeSize(tx, PROTOCOL_VERSION)); | entry.pushKV("size", (int)::GetSerializeSize(tx, PROTOCOL_VERSION)); | ||||
entry.pushKV("locktime", (int64_t)tx.nLockTime); | entry.pushKV("locktime", (int64_t)tx.nLockTime); | ||||
UniValue vin(UniValue::VARR); | UniValue vin(UniValue::VARR); | ||||
for (unsigned int i = 0; i < tx.vin.size(); i++) { | for (unsigned int i = 0; i < tx.vin.size(); i++) { | ||||
const CTxIn &txin = tx.vin[i]; | const CTxIn &txin = tx.vin[i]; | ||||
UniValue in(UniValue::VOBJ); | UniValue in(UniValue::VOBJ); | ||||
if (tx.IsCoinBase()) { | if (tx.IsCoinBase()) { | ||||
▲ Show 20 Lines • Show All 43 Lines • Show Last 20 Lines |