aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_packages.py
diff options
context:
space:
mode:
authorMichael Dietz <michael.dietz@waya.ai>2021-08-16 18:29:07 +0500
committerMichael Dietz <michael.dietz@waya.ai>2021-08-16 18:29:07 +0500
commit77349713b189e80f2c140db4df50177353a1cb83 (patch)
tree8b21b10191f2f75889bf89f436ee175696763fd7 /test/functional/mempool_packages.py
parent86dbd54ae8a8f9c693c0ea67114bbff24a0754df (diff)
test: use getmempoolentry instead of getrawmempool in functional tests when appropriate
Diffstat (limited to 'test/functional/mempool_packages.py')
-rwxr-xr-xtest/functional/mempool_packages.py63
1 files changed, 31 insertions, 32 deletions
diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py
index 5fc3ec23ae..173d1d7493 100755
--- a/test/functional/mempool_packages.py
+++ b/test/functional/mempool_packages.py
@@ -89,28 +89,28 @@ class MempoolPackagesTest(BitcoinTestFramework):
assert_equal(entry, mempool[x])
# Check that the descendant calculations are correct
- assert_equal(mempool[x]['descendantcount'], descendant_count)
- descendant_fees += mempool[x]['fee']
- assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee'])
- assert_equal(mempool[x]['fees']['base'], mempool[x]['fee'])
- assert_equal(mempool[x]['fees']['modified'], mempool[x]['modifiedfee'])
- assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN)
- assert_equal(mempool[x]['fees']['descendant'], descendant_fees)
- descendant_vsize += mempool[x]['vsize']
- assert_equal(mempool[x]['descendantsize'], descendant_vsize)
+ 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)
+ assert_equal(entry['fees']['descendant'], descendant_fees)
+ descendant_vsize += entry['vsize']
+ assert_equal(entry['descendantsize'], descendant_vsize)
descendant_count += 1
# Check that ancestor calculations are correct
- assert_equal(mempool[x]['ancestorcount'], ancestor_count)
- assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN)
- assert_equal(mempool[x]['ancestorsize'], ancestor_vsize)
- ancestor_vsize -= mempool[x]['vsize']
- ancestor_fees -= mempool[x]['fee']
+ assert_equal(entry['ancestorcount'], ancestor_count)
+ assert_equal(entry['ancestorfees'], ancestor_fees * COIN)
+ assert_equal(entry['ancestorsize'], ancestor_vsize)
+ ancestor_vsize -= entry['vsize']
+ ancestor_fees -= entry['fee']
ancestor_count -= 1
# Check that parent/child list is correct
- assert_equal(mempool[x]['spentby'], descendants[-1:])
- assert_equal(mempool[x]['depends'], ancestors[-2:-1])
+ assert_equal(entry['spentby'], descendants[-1:])
+ assert_equal(entry['depends'], ancestors[-2:-1])
# Check that getmempooldescendants is correct
assert_equal(sorted(descendants), sorted(self.nodes[0].getmempooldescendants(x)))
@@ -153,12 +153,12 @@ class MempoolPackagesTest(BitcoinTestFramework):
# Check that ancestor modified fees includes fee deltas from
# prioritisetransaction
self.nodes[0].prioritisetransaction(txid=chain[0], fee_delta=1000)
- mempool = self.nodes[0].getrawmempool(True)
ancestor_fees = 0
for x in chain:
- ancestor_fees += mempool[x]['fee']
- assert_equal(mempool[x]['fees']['ancestor'], ancestor_fees + Decimal('0.00001'))
- assert_equal(mempool[x]['ancestorfees'], ancestor_fees * COIN + 1000)
+ entry = self.nodes[0].getmempoolentry(x)
+ ancestor_fees += entry['fee']
+ 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)
@@ -166,13 +166,13 @@ class MempoolPackagesTest(BitcoinTestFramework):
# Check that descendant modified fees includes fee deltas from
# prioritisetransaction
self.nodes[0].prioritisetransaction(txid=chain[-1], fee_delta=1000)
- mempool = self.nodes[0].getrawmempool(True)
descendant_fees = 0
for x in reversed(chain):
- descendant_fees += mempool[x]['fee']
- assert_equal(mempool[x]['fees']['descendant'], descendant_fees + Decimal('0.00001'))
- assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN + 1000)
+ entry = self.nodes[0].getmempoolentry(x)
+ descendant_fees += entry['fee']
+ 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)
@@ -190,16 +190,15 @@ class MempoolPackagesTest(BitcoinTestFramework):
self.nodes[1].invalidateblock(self.nodes[1].getbestblockhash())
# Now check that the transaction is in the mempool, with the right modified fee
- mempool = self.nodes[0].getrawmempool(True)
-
descendant_fees = 0
for x in reversed(chain):
- descendant_fees += mempool[x]['fee']
+ entry = self.nodes[0].getmempoolentry(x)
+ descendant_fees += entry['fee']
if (x == chain[-1]):
- assert_equal(mempool[x]['modifiedfee'], mempool[x]['fee']+satoshi_round(0.00002))
- assert_equal(mempool[x]['fees']['modified'], mempool[x]['fee']+satoshi_round(0.00002))
- assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN + 2000)
- assert_equal(mempool[x]['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
+ assert_equal(entry['modifiedfee'], entry['fee']+satoshi_round(0.00002))
+ assert_equal(entry['fees']['modified'], entry['fee']+satoshi_round(0.00002))
+ assert_equal(entry['descendantfees'], descendant_fees * COIN + 2000)
+ assert_equal(entry['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
# Check that node1's mempool is as expected (-> custom ancestor limit)
mempool0 = self.nodes[0].getrawmempool(False)
@@ -255,7 +254,7 @@ class MempoolPackagesTest(BitcoinTestFramework):
# - txs from previous ancestor test (-> custom ancestor limit)
# - parent tx for descendant test
# - txs chained off parent tx (-> custom descendant limit)
- self.wait_until(lambda: len(self.nodes[1].getrawmempool(False)) ==
+ self.wait_until(lambda: len(self.nodes[1].getrawmempool()) ==
MAX_ANCESTORS_CUSTOM + 1 + MAX_DESCENDANTS_CUSTOM, timeout=10)
mempool0 = self.nodes[0].getrawmempool(False)
mempool1 = self.nodes[1].getrawmempool(False)