aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_packages.py
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2021-12-07 15:25:53 +0100
committerMarcoFalke <falke.marco@gmail.com>2021-12-07 15:26:06 +0100
commit4fd0ce75c59824a9b035a77bfea6df81f0e87a34 (patch)
tree940adbf007557f82afb8f25285f7a6b64f3cf15b /test/functional/mempool_packages.py
parent95fe477fd189ae30e76050b95280086d913e78c2 (diff)
parent2f9515f37addabde84c79926d7a24b2897a21dd1 (diff)
downloadbitcoin-4fd0ce75c59824a9b035a77bfea6df81f0e87a34.tar.xz
Merge bitcoin/bitcoin#22689: rpc: deprecate top-level fee fields in getmempool RPCs
2f9515f37addabde84c79926d7a24b2897a21dd1 rpc: move fees object to match help (josibake) 07ade7db8f919826c5e69bdaf7d54a6ae653175e doc: add release note for fee field deprecation (josibake) 2ee406ce3e9c252734cb391d85044ac389c34279 test: add functional test for deprecatedrpc=fees (josibake) 35d928c63237e31c99215e2d9d84782befd618d5 rpc: 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: reACK 2f9515f37addabde84c79926d7a24b2897a21dd1 glozow: utACK 2f9515f37addabde84c79926d7a24b2897a21dd1 Tree-SHA512: b175f4d39d26d96dc5bae26717d3ccfa5842d98ab402065880bfdcf4921b14ca692a8919fe4e9969acbb5c4d6e6d07dd6462a7e0a0a7342556279b381e1a004e
Diffstat (limited to 'test/functional/mempool_packages.py')
-rwxr-xr-xtest/functional/mempool_packages.py25
1 files changed, 9 insertions, 16 deletions
diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py
index dcbd340f11..068fdc0b65 100755
--- a/test/functional/mempool_packages.py
+++ b/test/functional/mempool_packages.py
@@ -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)