|
|
|
@ -62,11 +62,14 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
@@ -62,11 +62,14 @@ void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fInclud
|
|
|
|
|
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry) |
|
|
|
|
{ |
|
|
|
|
entry.push_back(Pair("txid", tx.GetHash().GetHex())); |
|
|
|
|
entry.push_back(Pair("hash", tx.GetWitnessHash().GetHex())); |
|
|
|
|
entry.push_back(Pair("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION))); |
|
|
|
|
entry.push_back(Pair("version", tx.nVersion)); |
|
|
|
|
entry.push_back(Pair("locktime", (int64_t)tx.nLockTime)); |
|
|
|
|
|
|
|
|
|
UniValue vin(UniValue::VARR); |
|
|
|
|
BOOST_FOREACH(const CTxIn& txin, tx.vin) { |
|
|
|
|
for (unsigned int i = 0; i < tx.vin.size(); i++) { |
|
|
|
|
const CTxIn& txin = tx.vin[i]; |
|
|
|
|
UniValue in(UniValue::VOBJ); |
|
|
|
|
if (tx.IsCoinBase()) |
|
|
|
|
in.push_back(Pair("coinbase", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); |
|
|
|
@ -78,6 +81,17 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
@@ -78,6 +81,17 @@ void TxToJSON(const CTransaction& tx, const uint256 hashBlock, UniValue& entry)
|
|
|
|
|
o.push_back(Pair("hex", HexStr(txin.scriptSig.begin(), txin.scriptSig.end()))); |
|
|
|
|
in.push_back(Pair("scriptSig", o)); |
|
|
|
|
} |
|
|
|
|
if (!tx.wit.IsNull()) { |
|
|
|
|
if (!tx.wit.vtxinwit[i].IsNull()) { |
|
|
|
|
UniValue txinwitness(UniValue::VARR); |
|
|
|
|
for (unsigned int j = 0; j < tx.wit.vtxinwit[i].scriptWitness.stack.size(); j++) { |
|
|
|
|
std::vector<unsigned char> item = tx.wit.vtxinwit[i].scriptWitness.stack[j]; |
|
|
|
|
txinwitness.push_back(HexStr(item.begin(), item.end())); |
|
|
|
|
} |
|
|
|
|
in.push_back(Pair("txinwitness", txinwitness)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
in.push_back(Pair("sequence", (int64_t)txin.nSequence)); |
|
|
|
|
vin.push_back(in); |
|
|
|
|
} |
|
|
|
@ -134,7 +148,8 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
@@ -134,7 +148,8 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
|
|
|
|
|
"{\n" |
|
|
|
|
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n" |
|
|
|
|
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n" |
|
|
|
|
" \"size\" : n, (numeric) The transaction size\n" |
|
|
|
|
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" |
|
|
|
|
" \"size\" : n, (numeric) The serialized transaction size\n" |
|
|
|
|
" \"version\" : n, (numeric) The version\n" |
|
|
|
|
" \"locktime\" : ttt, (numeric) The lock time\n" |
|
|
|
|
" \"vin\" : [ (array of json objects)\n" |
|
|
|
@ -146,6 +161,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
@@ -146,6 +161,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
|
|
|
|
|
" \"hex\": \"hex\" (string) hex\n" |
|
|
|
|
" },\n" |
|
|
|
|
" \"sequence\": n (numeric) The script sequence number\n" |
|
|
|
|
" \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" |
|
|
|
|
" }\n" |
|
|
|
|
" ,...\n" |
|
|
|
|
" ],\n" |
|
|
|
@ -443,6 +459,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
@@ -443,6 +459,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
|
|
|
|
|
"\nResult:\n" |
|
|
|
|
"{\n" |
|
|
|
|
" \"txid\" : \"id\", (string) The transaction id\n" |
|
|
|
|
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n" |
|
|
|
|
" \"size\" : n, (numeric) The transaction size\n" |
|
|
|
|
" \"version\" : n, (numeric) The version\n" |
|
|
|
|
" \"locktime\" : ttt, (numeric) The lock time\n" |
|
|
|
@ -454,6 +471,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
@@ -454,6 +471,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp)
|
|
|
|
|
" \"asm\": \"asm\", (string) asm\n" |
|
|
|
|
" \"hex\": \"hex\" (string) hex\n" |
|
|
|
|
" },\n" |
|
|
|
|
" \"txinwitness\": [\"hex\", ...] (array of string) hex-encoded witness data (if any)\n" |
|
|
|
|
" \"sequence\": n (numeric) The script sequence number\n" |
|
|
|
|
" }\n" |
|
|
|
|
" ,...\n" |
|
|
|
|