Skip to content

Commit 42cc2b6

Browse files
MarcoFalkevijaydasmp
authored andcommitted
Merge bitcoin#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: bitcoin#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 bitcoin#11218. ACKs for commit e16b6a: MarcoFalke: re-utACK e16b6a7 jnewbery: utACK e16b6a7 Tree-SHA512: ce95260fe7f280eacf4ff70bfffe02315c3a521b3b462a34e72a05b90733f40cc473319ac2df05d3e3c12cb7b1fbf2a1bbea632a8f979fff94207854cdbd494d
1 parent 2f7f338 commit 42cc2b6

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 dashd is started with `-deprecatedrpc=size`.

src/rpc/blockchain.cpp

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

439439
static std::string EntryDescriptionString()
440440
{
441-
return " \"size\" : n, (numeric) transaction size in bytes\n"
441+
return " \"vsize\" : n, (numeric) virtual transaction size. This can be different from actual serialized size for high-sigop transactions.\n"
442+
" \"size\" : n, (numeric) (DEPRECATED) same as vsize. Only returned if dashd is started with -deprecatedrpc=size\n"
443+
" size will be completely removed in v0.20.\n"
442444
" \"fee\" : n, (numeric) transaction fee in " + CURRENCY_UNIT + " (DEPRECATED)\n"
443445
" \"modifiedfee\" : n, (numeric) transaction fee with fee deltas used for mining priority (DEPRECATED)\n"
444446
" \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
@@ -475,7 +477,8 @@ static void entryToJSON(const CTxMemPool& pool, UniValue& info, const CTxMemPool
475477
fees.pushKV("descendant", ValueFromAmount(e.GetModFeesWithDescendants()));
476478
info.pushKV("fees", fees);
477479

478-
info.pushKV("size", (int)e.GetTxSize());
480+
info.pushKV("vsize", (int)e.GetTxSize());
481+
if (IsDeprecatedRPCEnabled("size")) info.pushKV("size", (int)e.GetTxSize());
479482
info.pushKV("fee", ValueFromAmount(e.GetFee()));
480483
info.pushKV("modifiedfee", ValueFromAmount(e.GetModifiedFee()));
481484
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
@@ -58,7 +58,7 @@ def run_test(self):
5858
for i in range(3):
5959
for j in txids[i]:
6060
assert j in mempool
61-
sizes[i] += mempool[j]['size']
61+
sizes[i] += mempool[j]['vsize']
6262
assert sizes[i] > MAX_BLOCK_SIZE # Fail => raise utxo_count
6363

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

0 commit comments

Comments
 (0)