Skip to content

Commit ce43630

Browse files
committed
Merge #8747: [rpc] Fix transaction size comments and RPC help text.
d29505d Fix transaction size comments. Size now refers to virtual size as defined in BIP141. (jonnynewbs)
2 parents 4cfd57d + d29505d commit ce43630

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/rpc/blockchain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,18 +331,18 @@ UniValue getdifficulty(const JSONRPCRequest& request)
331331

332332
std::string EntryDescriptionString()
333333
{
334-
return " \"size\" : n, (numeric) transaction size in bytes\n"
334+
return " \"size\" : n, (numeric) virtual transaction size as defined in BIP 141. This is different from actual serialized size for witness transactions as witness data is discounted.\n"
335335
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + "\n"
336336
" \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority\n"
337337
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
338338
" \"height\" : n, (numeric) block height when transaction entered pool\n"
339339
" \"startingpriority\" : n, (numeric) priority when transaction entered pool\n"
340340
" \"currentpriority\" : n, (numeric) transaction priority now\n"
341341
" \"descendantcount\" : n, (numeric) number of in-mempool descendant transactions (including this one)\n"
342-
" \"descendantsize\" : n, (numeric) size of in-mempool descendants (including this one)\n"
342+
" \"descendantsize\" : n, (numeric) virtual transaction size of in-mempool descendants (including this one)\n"
343343
" \"descendantfees\" : n, (numeric) modified fees (see above) of in-mempool descendants (including this one)\n"
344344
" \"ancestorcount\" : n, (numeric) number of in-mempool ancestor transactions (including this one)\n"
345-
" \"ancestorsize\" : n, (numeric) size of in-mempool ancestors (including this one)\n"
345+
" \"ancestorsize\" : n, (numeric) virtual transaction size of in-mempool ancestors (including this one)\n"
346346
" \"ancestorfees\" : n, (numeric) modified fees (see above) of in-mempool ancestors (including this one)\n"
347347
" \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
348348
" \"transactionid\", (string) parent transaction id\n"
@@ -703,7 +703,7 @@ UniValue getblock(const JSONRPCRequest& request)
703703
" \"confirmations\" : n, (numeric) The number of confirmations, or -1 if the block is not on the main chain\n"
704704
" \"size\" : n, (numeric) The block size\n"
705705
" \"strippedsize\" : n, (numeric) The block size excluding witness data\n"
706-
" \"weight\" : n (numeric) The block weight (BIP 141)\n"
706+
" \"weight\" : n (numeric) The block weight as defined in BIP 141\n"
707707
" \"height\" : n, (numeric) The block height or index\n"
708708
" \"version\" : n, (numeric) The block version\n"
709709
" \"versionHex\" : \"00000000\", (string) The block version formatted in hexadecimal\n"
@@ -1240,7 +1240,7 @@ UniValue getmempoolinfo(const JSONRPCRequest& request)
12401240
"\nResult:\n"
12411241
"{\n"
12421242
" \"size\": xxxxx, (numeric) Current tx count\n"
1243-
" \"bytes\": xxxxx, (numeric) Sum of all tx sizes\n"
1243+
" \"bytes\": xxxxx, (numeric) Sum of all virtual transaction sizes as defined in BIP 141. Differs from actual serialized size because witness data is discounted\n"
12441244
" \"usage\": xxxxx, (numeric) Total memory usage for the mempool\n"
12451245
" \"maxmempool\": xxxxx, (numeric) Maximum memory usage for the mempool\n"
12461246
" \"mempoolminfee\": xxxxx (numeric) Minimum fee for tx to be accepted\n"

src/rpc/mining.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,8 @@ UniValue estimatefee(const JSONRPCRequest& request)
779779
throw runtime_error(
780780
"estimatefee nblocks\n"
781781
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
782-
"confirmation within nblocks blocks.\n"
782+
"confirmation within nblocks blocks. Uses virtual transaction size of transaction\n"
783+
"as defined in BIP 141 (witness data is discounted).\n"
783784
"\nArguments:\n"
784785
"1. nblocks (numeric)\n"
785786
"\nResult:\n"
@@ -841,7 +842,8 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
841842
"\nWARNING: This interface is unstable and may disappear or change!\n"
842843
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
843844
"confirmation within nblocks blocks if possible and return the number of blocks\n"
844-
"for which the estimate is valid.\n"
845+
"for which the estimate is valid. Uses virtual transaction size as defined\n"
846+
"in BIP 141 (witness data is discounted).\n"
845847
"\nArguments:\n"
846848
"1. nblocks (numeric)\n"
847849
"\nResult:\n"

src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ class CTxMemPool
422422
unsigned int nTransactionsUpdated;
423423
CBlockPolicyEstimator* minerPolicyEstimator;
424424

425-
uint64_t totalTxSize; //!< sum of all mempool tx' byte sizes
425+
uint64_t totalTxSize; //!< sum of all mempool tx's virtual sizes. Differs from serialized tx size since witness data is discounted. Defined in BIP 141.
426426
uint64_t cachedInnerUsage; //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
427427

428428
CFeeRate minReasonableRelayFee;

0 commit comments

Comments
 (0)