Return size in bytes of a tx from getrawtransaction
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user