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
This commit is contained in:
1 parent
89e93135ae
commit
49997813a4
1 file changed
+15
-2
@@ -14,13 +14,19 @@ from test_framework.util import (
|
|||||||
satoshi_round,
|
satoshi_round,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# default limits
|
||||||
MAX_ANCESTORS = 25
|
MAX_ANCESTORS = 25
|
||||||
MAX_DESCENDANTS = 25
|
MAX_DESCENDANTS = 25
|
||||||
|
# custom limits for node1
|
||||||
|
MAX_ANCESTORS_CUSTOM = 5
|
||||||
|
|
||||||
class MempoolPackagesTest(BitcoinTestFramework):
|
class MempoolPackagesTest(BitcoinTestFramework):
|
||||||
def set_test_params(self):
|
def set_test_params(self):
|
||||||
self.num_nodes = 2
|
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):
|
def skip_test_if_missing_module(self):
|
||||||
self.skip_if_no_wallet()
|
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]['descendantfees'], descendant_fees * COIN + 2000)
|
||||||
assert_equal(mempool[x]['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
|
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
|
# TODO: test ancestor size limits
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user