mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-22 20:58:09 +02:00
Merge #12791: Expose a transaction's weight via RPC
9e50c337cNote new weight field in release-notes. (Matt Corallo)d0d9112b7Test new weight field in p2p_segwit (Matt Corallo)2874709a9Expose a transaction's weight via RPC (Matt Corallo) Pull request description: This seems like an obvious oversight. Tree-SHA512: defd047de34fb06a31f589e1a4eef68fcae85095cc67b7c8fb434237bb40300d7f3f97e852d3e7226330e26b96943846b7baf6da0cfc79db8d56e9c1f7848ad9
This commit is contained in:
@@ -161,6 +161,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry,
|
||||
entry.pushKV("version", tx.nVersion);
|
||||
entry.pushKV("size", (int)::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION));
|
||||
entry.pushKV("vsize", (GetTransactionWeight(tx) + WITNESS_SCALE_FACTOR - 1) / WITNESS_SCALE_FACTOR);
|
||||
entry.pushKV("weight", GetTransactionWeight(tx));
|
||||
entry.pushKV("locktime", (int64_t)tx.nLockTime);
|
||||
|
||||
UniValue vin(UniValue::VARR);
|
||||
|
||||
@@ -94,6 +94,7 @@ UniValue getrawtransaction(const JSONRPCRequest& request)
|
||||
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
|
||||
" \"size\" : n, (numeric) The serialized transaction size\n"
|
||||
" \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n"
|
||||
" \"weight\" : n, (numeric) The transaction's weight (between vsize*4-3 and vsize*4)\n"
|
||||
" \"version\" : n, (numeric) The version\n"
|
||||
" \"locktime\" : ttt, (numeric) The lock time\n"
|
||||
" \"vin\" : [ (array of json objects)\n"
|
||||
@@ -494,6 +495,7 @@ UniValue decoderawtransaction(const JSONRPCRequest& request)
|
||||
" \"hash\" : \"id\", (string) The transaction hash (differs from txid for witness transactions)\n"
|
||||
" \"size\" : n, (numeric) The transaction size\n"
|
||||
" \"vsize\" : n, (numeric) The virtual transaction size (differs from size for witness transactions)\n"
|
||||
" \"weight\" : n, (numeric) The transaction's weight (between vsize*4 - 3 and vsize*4)\n"
|
||||
" \"version\" : n, (numeric) The version\n"
|
||||
" \"locktime\" : ttt, (numeric) The lock time\n"
|
||||
" \"vin\" : [ (array of json objects)\n"
|
||||
|
||||
Reference in New Issue
Block a user