Skip to content

Commit e14cd04

Browse files
author
MarcoFalke
committed
Merge #15637: rpc: Rename size to vsize in mempool related calls
e16b6a7 rpc: Rename size to vsize in mempool related calls (Miguel Herranz) Pull request description: #13008 rebased on `master`, with release notes split out. > In getmempoolancestors, getmempooldescendants, getmempoolentry and getrawmempool RPCs size returns the virtual transaction size as defined in BIP 141. Renaming it to vsize makes it consistent with returned value and other calls such as getrawtransaction. > > Related to #11218. ACKs for commit e16b6a: MarcoFalke: re-utACK e16b6a7 jnewbery: utACK e16b6a7 Tree-SHA512: ce95260fe7f280eacf4ff70bfffe02315c3a521b3b462a34e72a05b90733f40cc473319ac2df05d3e3c12cb7b1fbf2a1bbea632a8f979fff94207854cdbd494d
2 parents 8a8b03e + e16b6a7 commit e14cd04

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

doc/release-notes-15637.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
RPC changes
2+
-----------
3+
In getmempoolancestors, getmempooldescendants, getmempoolentry and getrawmempool RPCs, to be consistent with the returned value and other RPCs such as getrawtransaction, vsize has been added and size is now deprecated. size will only be returned if bitcoind is started with `-deprecatedrpc=size`.

src/rpc/blockchain.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,9 @@ static UniValue getdifficulty(const JSONRPCRequest& request)
378378

379379
static std::string EntryDescriptionString()
380380
{
381-
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"
381+
return " \"vsize\" : 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"
382+
" \"size\" : n, (numeric) (DEPRECATED) same as vsize. Only returned if bitcoind is started with -deprecatedrpc=size\n"
383+
" size will be completely removed in v0.20.\n"
382384
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + " (DEPRECATED)\n"
383385
" \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED)\n"
384386
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
@@ -416,7 +418,8 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
416418
fees.pushKV("descendant", ValueFromAmount(e.GetModFeesWithDescendants()));
417419
info.pushKV("fees", fees);
418420

419-
info.pushKV("size", (int)e.GetTxSize());
421+
info.pushKV("vsize", (int)e.GetTxSize());
422+
if (IsDeprecatedRPCEnabled("size")) info.pushKV("size", (int)e.GetTxSize());
420423
info.pushKV("fee", ValueFromAmount(e.GetFee()));
421424
info.pushKV("modifiedfee", ValueFromAmount(e.GetModifiedFee()));
422425
info.pushKV("time", e.GetTime());

test/functional/mempool_packages.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ def run_test(self):
5858
assert_equal(len(mempool), MAX_ANCESTORS)
5959
descendant_count = 1
6060
descendant_fees = 0
61-
descendant_size = 0
61+
descendant_vsize = 0
6262

63-
ancestor_size = sum([mempool[tx]['size'] for tx in mempool])
63+
ancestor_vsize = sum([mempool[tx]['vsize'] for tx in mempool])
6464
ancestor_count = MAX_ANCESTORS
6565
ancestor_fees = sum([mempool[tx]['fee'] for tx in mempool])
6666

@@ -79,15 +79,15 @@ def run_test(self):
7979
assert_equal(mempool[x]['fees']['modified'], mempool[x]['modifiedfee'])
8080
assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN)
8181
assert_equal(mempool[x]['fees']['descendant'], descendant_fees)
82-
descendant_size += mempool[x]['size']
83-
assert_equal(mempool[x]['descendantsize'], descendant_size)
82+
descendant_vsize += mempool[x]['vsize']
83+
assert_equal(mempool[x]['descendantsize'], descendant_vsize)
8484
descendant_count += 1
8585

8686
# Check that ancestor calculations are correct
8787
assert_equal(mempool[x]['ancestorcount'], ancestor_count)
8888
assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN)
89-
assert_equal(mempool[x]['ancestorsize'], ancestor_size)
90-
ancestor_size -= mempool[x]['size']
89+
assert_equal(mempool[x]['ancestorsize'], ancestor_vsize)
90+
ancestor_vsize -= mempool[x]['vsize']
9191
ancestor_fees -= mempool[x]['fee']
9292
ancestor_count -= 1
9393

test/functional/mining_prioritisetransaction.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def run_test(self):
6464
for i in range(3):
6565
for j in txids[i]:
6666
assert j in mempool
67-
sizes[i] += mempool[j]['size']
67+
sizes[i] += mempool[j]['vsize']
6868
assert sizes[i] > MAX_BLOCK_BASE_SIZE # Fail => raise utxo_count
6969

7070
# add a fee delta to something in the cheapest bucket and make sure it gets mined

0 commit comments

Comments
 (0)