aboutsummaryrefslogtreecommitdiff
path: root/test/functional/mempool_packages.py
diff options
context:
space:
mode:
authorSebastian Falbesoner <sebastian.falbesoner@gmail.com>2019-11-10 19:55:28 +0100
committerSebastian Falbesoner <sebastian.falbesoner@gmail.com>2019-11-11 22:37:00 +0100
commit49997813a4db388b2810e5e27ef771e8aa6a1f03 (patch)
tree4d5c554ae4515ffd8a2dc28f94365f8685cf8908 /test/functional/mempool_packages.py
parent89e93135aedf984f7a98771f047e2beb6cdbdb8e (diff)
downloadbitcoin-49997813a4db388b2810e5e27ef771e8aa6a1f03.tar.xz
test: check custom ancestor limit in mempool_packages.py
To test the custom ancestor limit on node1 (passed by the argument -limitancestorcount), we check for three conditions: -> the # of txs in the node1 mempool is equal to the the limit -> all txs in node1 mempool are a subset of txs in node0 mempool -> the node1 mempool txs match the start of the constructed tx-chain
Diffstat (limited to 'test/functional/mempool_packages.py')
-rwxr-xr-xtest/functional/mempool_packages.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/test/functional/mempool_packages.py b/test/functional/mempool_packages.py
index c7d241503a..7014105d88 100755
--- a/test/functional/mempool_packages.py
+++ b/test/functional/mempool_packages.py
@@ -14,13 +14,19 @@ from test_framework.util import (
satoshi_round,
)
+# default limits
MAX_ANCESTORS = 25
MAX_DESCENDANTS = 25
+# custom limits for node1
+MAX_ANCESTORS_CUSTOM = 5
class MempoolPackagesTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 2
- self.extra_args = [["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount=5"]]
+ self.extra_args = [
+ ["-maxorphantx=1000"],
+ ["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)],
+ ]
def skip_test_if_missing_module(self):
self.skip_if_no_wallet()
@@ -188,7 +194,14 @@ class MempoolPackagesTest(BitcoinTestFramework):
assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN + 2000)
assert_equal(mempool[x]['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
- # TODO: check that node1's mempool is as expected
+ # Check that node1's mempool is as expected (-> custom ancestor limit)
+ mempool0 = self.nodes[0].getrawmempool(False)
+ mempool1 = self.nodes[1].getrawmempool(False)
+ assert_equal(len(mempool1), MAX_ANCESTORS_CUSTOM)
+ assert set(mempool1).issubset(set(mempool0))
+ for tx in chain[:MAX_ANCESTORS_CUSTOM]:
+ assert tx in mempool1
+ # TODO: more detailed check of node1's mempool (fees etc.)
# TODO: test ancestor size limits