test: check custom ancestor limit in mempool_packages.py #17435

pull theStack wants to merge 1 commits into bitcoin:master from theStack:20191110-test-check_custom_ancestor_limit_in_mempool-packages changing 1 files +15 −2
  1. theStack commented at 7:34 pm on November 10, 2019: member

    The functional test mempool_packages.py starts one node with default ancestor/descendant limit settings and one with a custom, reduced ancestor limit (currently -limitancestorcount=5). The effect of the latter had not been tested yet though. This is approached in this PR by checking on the expected mempool contents of node1 after the node0 ancestor tests are done, via the following 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

    Note that this still doesn’t fully check the expected mempool of node1 (e.g. that it isn’t influenced by prioritisetransaction RPC on node0), hence I add another TODO. In the future it would make sense to also set a custom descendant limit when the second TODO about checking node1’s mempool is approached: https://github.com/bitcoin/bitcoin/blob/89e93135aedf984f7a98771f047e2beb6cdbdb8e/test/functional/mempool_packages.py#L228

  2. fanquake added the label Tests on Nov 10, 2019
  3. in test/functional/mempool_packages.py:201 in fce1f72f8e outdated
    193@@ -188,7 +194,14 @@ def run_test(self):
    194             assert_equal(mempool[x]['descendantfees'], descendant_fees * COIN + 2000)
    195             assert_equal(mempool[x]['fees']['descendant'], descendant_fees+satoshi_round(0.00002))
    196 
    197-        # TODO: check that node1's mempool is as expected
    198+        # Check that node1's mempool is as expected (-> custom ancestor limit)
    199+        mempool0 = self.nodes[0].getrawmempool(False)
    200+        mempool1 = self.nodes[1].getrawmempool(False)
    201+        assert_equal(len(mempool1), MAX_ANCESTORS_CUSTOM)
    202+        assert(set(mempool1).issubset(set(mempool0)))
    


    MarcoFalke commented at 7:27 pm on November 11, 2019:
    0        assert set(mempool1).issubset(set(mempool0))
    
  4. in test/functional/mempool_packages.py:203 in fce1f72f8e outdated
    199+        mempool0 = self.nodes[0].getrawmempool(False)
    200+        mempool1 = self.nodes[1].getrawmempool(False)
    201+        assert_equal(len(mempool1), MAX_ANCESTORS_CUSTOM)
    202+        assert(set(mempool1).issubset(set(mempool0)))
    203+        for tx in chain[:MAX_ANCESTORS_CUSTOM]:
    204+            assert(tx in mempool1)
    


    MarcoFalke commented at 7:28 pm on November 11, 2019:
    0            assert tx in mempool1
    
  5. in test/functional/mempool_packages.py:204 in fce1f72f8e outdated
    200+        mempool1 = self.nodes[1].getrawmempool(False)
    201+        assert_equal(len(mempool1), MAX_ANCESTORS_CUSTOM)
    202+        assert(set(mempool1).issubset(set(mempool0)))
    203+        for tx in chain[:MAX_ANCESTORS_CUSTOM]:
    204+            assert(tx in mempool1)
    205+        # TODO: more detailled check of node1's mempool (fees etc.)
    


    MarcoFalke commented at 7:28 pm on November 11, 2019:
    0        # TODO: more  detailed check of node1's mempool (fees etc.)
    
  6. in test/functional/mempool_packages.py:28 in fce1f72f8e outdated
    24     def set_test_params(self):
    25         self.num_nodes = 2
    26-        self.extra_args = [["-maxorphantx=1000"], ["-maxorphantx=1000", "-limitancestorcount=5"]]
    27+        self.extra_args = [
    28+            ["-maxorphantx=1000"],
    29+            ["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)]
    


    MarcoFalke commented at 7:29 pm on November 11, 2019:
    0            ["-maxorphantx=1000", "-limitancestorcount={}".format(MAX_ANCESTORS_CUSTOM)],
    
  7. MarcoFalke commented at 7:29 pm on November 11, 2019: member
    LGTM, sorry for nitpicking. Feel free to ignore those
  8. 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
    49997813a4
  9. theStack force-pushed on Nov 11, 2019
  10. theStack commented at 9:44 pm on November 11, 2019: member
    @MarcoFalke: Thanks for reviewing, always glad to get feedback, even though its only nits. (I have to admit I wasn’t even aware that the parantheses can be omitted for Python asserts… guess I assumed its just a function call).
  11. MarcoFalke commented at 7:53 pm on November 12, 2019: member

    ACK 49997813a4db388b2810e5e27ef771e8aa6a1f03 👲

    Signature:

     0-----BEGIN PGP SIGNED MESSAGE-----
     1Hash: SHA512
     2
     3ACK 49997813a4db388b2810e5e27ef771e8aa6a1f03 👲
     4-----BEGIN PGP SIGNATURE-----
     5
     6iQGzBAEBCgAdFiEE+rVPoUahrI9sLGYTzit1aX5ppUgFAlwqrYAACgkQzit1aX5p
     7pUj3dwwAyzXxmPEnvF4kSWp0hSjOwaT8zmwr0PzXqJ+x9ZuwIFqEwMkxq8gLP9GE
     8OL+N16kkFdXU+NVNKR+yBVO6SxGGIjWc1Lgf7cgkqsT+AQyqJ6ZUyxVQAYWX6aE/
     92yRbLh91jM6g9xPrS4aRQmzBRuTXbXjR8vaazytmRDRxYJvbyh2hVUbJLk3+9N/s
    10+sUJ9bUQLT4nOa4/xCRPUaP524j5/2iGIIY3zjiCS5cB0fgu9R1ECeouNZKYCRGk
    11PdCVDmnRe80cf6gQ4oMLVUXffTJGkDZ3v1ioiZyypNCXD2LFWk1/F/Rx2cO1HFTx
    12DDizqNdRZYwJvN8PdHH+RXie9qtjn6CPZDH95GX7VQMRL3MzR79jGgNKcDaRnm1o
    134/HyYbRRcODodAAG1bdWeSM6FA/3eCH5hQfCW7YXakTbOEAWX62T1SrunQ7AseJ4
    14jXu4jRjjJ8kud8dAqHKK1ahORiamnRvbEyfFjB0J8lnbgInhbPKXRtqvVfkdSfr7
    15539CNBMb
    16=1woH
    17-----END PGP SIGNATURE-----
    

    Timestamp of file with hash 7d1507105d97dc06921b89a9abfadd83a2af4691c89687f45ab2592868d52a25 -

  12. MarcoFalke referenced this in commit 8237889e8d on Nov 12, 2019
  13. MarcoFalke merged this on Nov 12, 2019
  14. MarcoFalke closed this on Nov 12, 2019

  15. MarcoFalke referenced this in commit 1615043935 on Feb 27, 2020
  16. sidhujag referenced this in commit 8dcdc4b2c3 on Feb 28, 2020
  17. sidhujag referenced this in commit 7b4ba9c5e1 on Nov 10, 2020
  18. theStack deleted the branch on Dec 1, 2020
  19. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-30 09:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me