Skip to content

Commit d29505d

Browse files
committed
Fix transaction size comments. Size now refers to virtual size as defined in BIP141.
1 parent 7490ae8 commit d29505d

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
@@ -775,7 +775,8 @@ UniValue estimatefee(const JSONRPCRequest& request)
775775
throw runtime_error(
776776
"estimatefee nblocks\n"
777777
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
778-
"confirmation within nblocks blocks.\n"
778+
"confirmation within nblocks blocks. Uses virtual transaction size of transaction\n"
779+
"as defined in BIP 141 (witness data is discounted).\n"
779780
"\nArguments:\n"
780781
"1. nblocks (numeric)\n"
781782
"\nResult:\n"
@@ -835,7 +836,8 @@ UniValue estimatesmartfee(const JSONRPCRequest& request)
835836
"\nWARNING: This interface is unstable and may disappear or change!\n"
836837
"\nEstimates the approximate fee per kilobyte needed for a transaction to begin\n"
837838
"confirmation within nblocks blocks if possible and return the number of blocks\n"
838-
"for which the estimate is valid.\n"
839+
"for which the estimate is valid. Uses virtual transaction size as defined\n"
840+
"in BIP 141 (witness data is discounted).\n"
839841
"\nArguments:\n"
840842
"1. nblocks (numeric)\n"
841843
"\nResult:\n"

src/txmempool.h

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

424-
uint64_t totalTxSize; //!< sum of all mempool tx' byte sizes
424+
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.
425425
uint64_t cachedInnerUsage; //!< sum of dynamic memory usage of all the map elements (NOT the maps themselves)
426426

427427
CFeeRate minReasonableRelayFee;

0 commit comments

Comments
 (0)