Return size in bytes of a tx from getrawtransaction

This commit is contained in:
Jonathan "Duke" Leto
2022-06-26 04:40:06 -07:00
parent 2b336dccc0
commit 0a9abedc5d

View File

@@ -367,6 +367,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp, const CPubKey& my
"\nResult (if verbose > 0):\n"
"{\n"
" \"hex\" : \"data\", (string) The serialized, hex-encoded data for 'txid'\n"
" \"size\" : n, (numeric) The length in bytes\n"
" \"txid\" : \"id\", (string) The transaction id (same as provided)\n"
" \"version\" : n, (numeric) The version\n"
" \"locktime\" : ttt, (numeric) The lock time\n"
@@ -453,6 +454,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp, const CPubKey& my
UniValue result(UniValue::VOBJ);
result.push_back(Pair("hex", strHex));
result.push_back(Pair("size", GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION) ));
TxToJSONExpanded(tx, hashBlock, result, nHeight, nConfirmations, nBlockTime);
return result;
}