mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-11 21:20:39 +02:00
Merge bitcoin/bitcoin#32800: rpc: Distinguish between vsize and sigop adjusted mempool vsize
29b124416edoc: add release notes for 32800 (Musa Haruna)5d25a0c28drpc: add `vsize_adjusted` field to getrawtransaction output for mempool transactions (Musa Haruna)eaef8d3111rpc: add `vsize_adjusted` and `vsize_bip141` field to mempool-related RPCs (Musa Haruna) Pull request description: ### Motivation and Problem `CTxMemPoolEntry::GetTxSize()` returns the larger of two values: the BIP 141 virtual size (vsize) and the "sigop-adjusted size." This sigop-adjusted size is used by mempool validation and mining algorithms as a safeguard to prevent overfilling blocks with transactions that approach both the weight and signature operation (sigop) limits in a way that could harm block space efficiency. In the current implementation, the sigop-adjusted size is reported as the "vsize" in RPCs that provide mempool transaction data, such as `getmempoolentry`, `getrawmempool`, `testmempoolaccept`, and `submitpackage`. However, the documentation for these RPCs typically describes this value simply as the "virtual transaction size as defined in BIP 141," without acknowledging the sigop adjustment. Since the reported size may differ from the pure BIP 141 definition, this confuses people as in this [tweet](https://x.com/mononautical/status/1646166180145577990?s=20), discrepancy can be misleading, as the reported size may differ from the pure BIP 141 definition. ### Proposed Solution To resolve this, all mempool-related RPCs now return two separate fields: **vsize_adjusted:** the sigop-adjusted size, i.e. max(BIP 141 vsize, sigop-adjusted size), which reflects the value previously returned under the vsize label and continues to drive mempool acceptance and block template scoring. **vsize_bip141:** the pure BIP 141 virtual size, strictly `ceil(weight/4)`, matching the consensus definition is now reported here in `vsize_bip141` field. `vsize` field in now marked as DEPRECATED and users are advised to use the new `vsize_bip141` field for pure virtual size instead. This means that clients that depends on mempool policy size reported vsize will use `vsize_adjusted`, while `vsize` is now purely BIP 141. Additionally, this PR updates the relevant RPC help text to clearly document the distinction between these two sizes, and adds supporting documentation `doc/policy/feerates-and-vsize.md` to better explain fee rates, virtual size calculations, sigop adjustments, and the mempool policy heuristics. A new field, vsize_adjusted, has also been added to the getrawtransaction RPC result when input information (transaction is in the mempool) is available. Exposing this value provides users with more precise insight into how the transaction’s sigops impact its effective size for policy and fee estimation. Note: This picks up work from the closed [#27591](https://github.com/bitcoin/bitcoin/pull/27591) Fixes [#32775](https://github.com/bitcoin/bitcoin/issues/32775) ACKs for top commit: achow101: ACK29b124416ehodlinator: re-ACK29b124416eismaelsadeeq: Code review ACK29b124416esedited: ACK29b124416eTree-SHA512: 9322ab1a2f7561b4221fb2bbe9f822c402f845c52a93de14008c1e5bc33e5c6f19ebc647ab6615b7c6be137c76cff6a33c6920818a78813de5632eb88c96a876
This commit is contained in:
9
doc/release-notes-32800.md
Normal file
9
doc/release-notes-32800.md
Normal file
@@ -0,0 +1,9 @@
|
||||
- Mempool RPCs (`getrawmempool`, `getmempoolentry`, `testmempoolaccept`, `submitpackage`)
|
||||
now include an additional field `vsize_adjusted` (which is the sigop-adjusted virtual size
|
||||
used for policy) and `vsize_bip141` (which represents the raw BIP141 virtual size).
|
||||
While `vsize` is marked as DEPRECATED, it was previously erroneously described as the BIP 141
|
||||
vsize, but is actually sigops-adjusted vsize. Use `vsize_bip141` to actually get that behavior
|
||||
or switch to the explicit `vsize_adjusted` for retained behavior.
|
||||
|
||||
- `getrawtransaction` RPC now includes an additional field `vsize_adjusted`, which is the
|
||||
sigop-adjusted virtual size if the transaction is in the mempool.
|
||||
Reference in New Issue
Block a user