mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-03 17:54:19 +02:00
Merge bitcoin/bitcoin#22689: rpc: deprecate top-level fee fields in getmempool RPCs
2f9515f37arpc: move fees object to match help (josibake)07ade7db8fdoc: add release note for fee field deprecation (josibake)2ee406ce3etest: add functional test for deprecatedrpc=fees (josibake)35d928c632rpc: deprecate fee fields from mempool entries (josibake) Pull request description: per #22682 , top level fee fields for mempool entries have been deprecated since 0.17 but are still returned. this PR properly deprecates them so that they are no longer returned unless `-deprecatedrpc=fees` is passed. the first commit takes care of deprecation and also updates `test/functional/mempool_packages.py` to only use the `fees` object. the second commit adds a new functional test for `-deprecatedrpc=fees` closes #22682 ## questions for the reviewer * `-deprecatedrpc=fees` made the most sense to me, but happy to change if there is a name that makes more sense * #22682 seems to indicate that after some period of time, the fields will be removed all together. if we have a rough idea of when this will be, i can add a `TODO: fully remove in vXX` comment to `entryToJSON` ## testing to get started on testing, compile, run the tests, and start your node with the deprecated rpcs flag: ```bash ./src/bitcoind -daemon -deprecatedrpc=fees ``` you should see entries with the deprecated fields like so: ```json { "<txid>": { "fees": { "base": 0.00000671, "modified": 0.00000671, "ancestor": 0.00000671, "descendant": 0.00000671 }, "fee": 0.00000671, "modifiedfee": 0.00000671, "descendantfees": 671, "ancestorfees": 671, "vsize": 144, "weight": 573, ... }, ``` you can also check `getmempoolentry` using any of the txid's from the output above. next start the node without the deprecated flag, repeat the commands from above and verify that the deprecated fields are no longer present at the top level, but present in the "fees" object ACKs for top commit: jnewbery: reACK2f9515f37aglozow: utACK2f9515f37aTree-SHA512: b175f4d39d26d96dc5bae26717d3ccfa5842d98ab402065880bfdcf4921b14ca692a8919fe4e9969acbb5c4d6e6d07dd6462a7e0a0a7342556279b381e1a004e
This commit is contained in:
@@ -91,7 +91,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
|
||||
assert_equal(ancestor_vsize, sum([mempool[tx]['vsize'] for tx in mempool]))
|
||||
ancestor_count = MAX_ANCESTORS
|
||||
assert_equal(ancestor_fees, sum([mempool[tx]['fee'] for tx in mempool]))
|
||||
assert_equal(ancestor_fees, sum([mempool[tx]['fees']['base'] for tx in mempool]))
|
||||
|
||||
descendants = []
|
||||
ancestors = list(chain)
|
||||
@@ -102,11 +102,8 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
|
||||
# Check that the descendant calculations are correct
|
||||
assert_equal(entry['descendantcount'], descendant_count)
|
||||
descendant_fees += entry['fee']
|
||||
assert_equal(entry['modifiedfee'], entry['fee'])
|
||||
assert_equal(entry['fees']['base'], entry['fee'])
|
||||
assert_equal(entry['fees']['modified'], entry['modifiedfee'])
|
||||
assert_equal(entry['descendantfees'], descendant_fees * COIN)
|
||||
descendant_fees += entry['fees']['base']
|
||||
assert_equal(entry['fees']['modified'], entry['fees']['base'])
|
||||
assert_equal(entry['fees']['descendant'], descendant_fees)
|
||||
descendant_vsize += entry['vsize']
|
||||
assert_equal(entry['descendantsize'], descendant_vsize)
|
||||
@@ -114,10 +111,10 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
|
||||
# Check that ancestor calculations are correct
|
||||
assert_equal(entry['ancestorcount'], ancestor_count)
|
||||
assert_equal(entry['ancestorfees'], ancestor_fees * COIN)
|
||||
assert_equal(entry['fees']['ancestor'], ancestor_fees)
|
||||
assert_equal(entry['ancestorsize'], ancestor_vsize)
|
||||
ancestor_vsize -= entry['vsize']
|
||||
ancestor_fees -= entry['fee']
|
||||
ancestor_fees -= entry['fees']['base']
|
||||
ancestor_count -= 1
|
||||
|
||||
# Check that parent/child list is correct
|
||||
@@ -168,9 +165,8 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
ancestor_fees = 0
|
||||
for x in chain:
|
||||
entry = self.nodes[0].getmempoolentry(x)
|
||||
ancestor_fees += entry['fee']
|
||||
ancestor_fees += entry['fees']['base']
|
||||
assert_equal(entry['fees']['ancestor'], ancestor_fees + Decimal('0.00001'))
|
||||
assert_equal(entry['ancestorfees'], ancestor_fees * COIN + 1000)
|
||||
|
||||
# Undo the prioritisetransaction for later tests
|
||||
self.nodes[0].prioritisetransaction(txid=chain[0], fee_delta=-1000)
|
||||
@@ -182,9 +178,8 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
descendant_fees = 0
|
||||
for x in reversed(chain):
|
||||
entry = self.nodes[0].getmempoolentry(x)
|
||||
descendant_fees += entry['fee']
|
||||
descendant_fees += entry['fees']['base']
|
||||
assert_equal(entry['fees']['descendant'], descendant_fees + Decimal('0.00001'))
|
||||
assert_equal(entry['descendantfees'], descendant_fees * COIN + 1000)
|
||||
|
||||
# Adding one more transaction on to the chain should fail.
|
||||
assert_raises_rpc_error(-26, "too-long-mempool-chain", chain_transaction, self.nodes[0], [txid], [vout], value, fee, 1)
|
||||
@@ -204,11 +199,9 @@ class MempoolPackagesTest(BitcoinTestFramework):
|
||||
descendant_fees = 0
|
||||
for x in reversed(chain):
|
||||
entry = self.nodes[0].getmempoolentry(x)
|
||||
descendant_fees += entry['fee']
|
||||
descendant_fees += entry['fees']['base']
|
||||
if (x == chain[-1]):
|
||||
assert_equal(entry['modifiedfee'], entry['fee'] + Decimal("0.00002"))
|
||||
assert_equal(entry['fees']['modified'], entry['fee'] + Decimal("0.00002"))
|
||||
assert_equal(entry['descendantfees'], descendant_fees * COIN + 2000)
|
||||
assert_equal(entry['fees']['modified'], entry['fees']['base'] + Decimal("0.00002"))
|
||||
assert_equal(entry['fees']['descendant'], descendant_fees + Decimal("0.00002"))
|
||||
|
||||
# Check that node1's mempool is as expected (-> custom ancestor limit)
|
||||
|
||||
Reference in New Issue
Block a user