[tests] remove maxblocksinflight.py (functionality covered by other test) #10023

pull jnewbery wants to merge 1 commits into bitcoin:master from jnewbery:improvemaxblocksinflight changing 3 files +1 −95
  1. jnewbery commented at 7:40 PM on March 17, 2017: member

    EDIT: we can remove the maxblocksinflight test entirely. See #10023 (comment)

    ~maxblocksinflight.py had a very strange structure where the~ ~fucntionality of the test was a method of the NodeConnCB object. This~ ~commit tidies up the structure of the test and brings it in line with~ ~the other functional tests.~

  2. fanquake added the label Tests on Mar 18, 2017
  3. fanquake commented at 10:57 PM on March 22, 2017: member

    Needs a rebase.

  4. jnewbery force-pushed on Apr 12, 2017
  5. jnewbery commented at 2:00 PM on April 12, 2017: member

    rebased

  6. sdaftuar commented at 9:19 PM on April 12, 2017: member

    Restructuring this sounds good, but now that we don't send getdata's in response to inv's anymore, perhaps this test should be rewritten to use headers for announcements instead?

  7. jnewbery commented at 11:12 PM on April 12, 2017: member

    You're correct. On closer inspection, this test case is actually testing nothing. The only thing it asserts on is that the node hasn't sent us too many getdata requests, but since nodes no longer sends getdata messages in response to block invs, it's just testing that 0 < 256:

    ./maxblocksinflight.py
    2017-04-12 22:07:31.285000 TestFramework (INFO): Initializing test directory /tmp/user/1000/testk493pd32/12847
    2017-04-12 22:07:31.563000 TestFramework.mininode (INFO): Connecting to Bitcoin Node: 127.0.0.1:13956
    2017-04-12 22:07:33.574000 TestFramework (INFO): Round 0: success (total requests: 0)
    2017-04-12 22:07:35.577000 TestFramework (INFO): Round 1: success (total requests: 0)
    2017-04-12 22:07:37.582000 TestFramework (INFO): Round 2: success (total requests: 0)
    2017-04-12 22:07:39.611000 TestFramework (INFO): Round 3: success (total requests: 0)
    2017-04-12 22:07:39.611000 TestFramework (INFO): Stopping nodes
    

    the headers-first sync'ing is covered pretty well by sendheaders.py. Should we just retire this test case?

  8. sdaftuar commented at 12:29 AM on April 13, 2017: member

    Well, I'd say that if it's not too much work, we should just fix this test case to test the maxblocksinflight behavior correctly. Ie, announce 17 or more block headers, and verify we only get 16 getdata requests.

  9. jnewbery commented at 1:15 PM on April 13, 2017: member

    This line: https://github.com/bitcoin/bitcoin/blob/70f6f56e9dde0d0eb1a51e70c051b8fa3ba9535f/test/functional/sendheaders.py#L517 and the block below test that when there are more than 16 headers messages sent, the peer will only send get_data for 16 of them.

    I think that covers the maxblocksinflight test, but let me know if you think it needs expanding.

  10. [tests] Remove maxblocksinflight testcase
    maxblocksinflight tested that a node would not send get_data messages
    for more than 16 new blocks at the same time. bitcoin core no longer
    responds to block invs with get_data, since it does headers-first
    sync'ing. This test was therefore testing nothing and can be removed.
    
    the sendheaders test script tests that bitcoin will not send get_headers
    for more than 16 blocks simultaneously.
    5f4bcf28ef
  11. jnewbery force-pushed on Apr 13, 2017
  12. jnewbery commented at 3:51 PM on April 13, 2017: member

    @sdaftuar - as discussed, we can remove maxblocksinflight entirely.

  13. jnewbery renamed this:
    Improve maxblocksinflight.py
    [tests] remove maxblocksinflight.py (functionality covered by other test)
    on Apr 13, 2017
  14. in test/functional/maxblocksinflight.py:26 in 5f4bcf28ef
      21 | -        self.log.debug("got getdata %s" % repr(message))
      22 | -        # Log the requests
      23 | -        for inv in message.inv:
      24 | -            if inv.hash not in self.blockReqCounts:
      25 | -                self.blockReqCounts[inv.hash] = 0
      26 | -            self.blockReqCounts[inv.hash] += 1
    


    jimmysong commented at 7:56 PM on April 20, 2017:

    If I'm understanding correctly, this method doesn't get called anymore since getdata isn't the response to inv?


    jnewbery commented at 1:10 PM on April 25, 2017:

    correct

  15. in test/functional/maxblocksinflight.py:56 in 5f4bcf28ef
      51 | -            # Wait and see how many blocks were requested
      52 | -            time.sleep(2)
      53 | -
      54 | -            total_requests = 0
      55 | -            with mininode_lock:
      56 | -                for key in self.blockReqCounts:
    


    jimmysong commented at 7:57 PM on April 20, 2017:

    And this should be an empty dict, correct?


    jnewbery commented at 1:11 PM on April 25, 2017:

    yes

  16. in test/functional/maxblocksinflight.py:60 in 5f4bcf28ef
      55 | -            with mininode_lock:
      56 | -                for key in self.blockReqCounts:
      57 | -                    total_requests += self.blockReqCounts[key]
      58 | -                    if self.blockReqCounts[key] > 1:
      59 | -                        raise AssertionError("Error, test failed: block %064x requested more than once" % key)
      60 | -            if total_requests > MAX_REQUESTS:
    


    jimmysong commented at 7:57 PM on April 20, 2017:

    And finally, total_requests is 0 every time?


    jnewbery commented at 1:12 PM on April 25, 2017:

    exactly, and 0 <= 128 last time I checked, so this test always passes.

  17. jimmysong approved
  18. jimmysong commented at 8:00 PM on April 20, 2017: contributor

    ACK 5f4bcf28ef8a1b775b12c9ff06367fd6656e91c3

    This removes a test that doesn't do anything.

  19. MarcoFalke merged this on Apr 23, 2017
  20. MarcoFalke closed this on Apr 23, 2017

  21. MarcoFalke referenced this in commit c530c15180 on Apr 23, 2017
  22. jnewbery deleted the branch on Apr 25, 2017
  23. PastaPastaPasta referenced this in commit 3a8bc2fbb3 on May 21, 2019
  24. PastaPastaPasta referenced this in commit beae267d68 on May 22, 2019
  25. PastaPastaPasta referenced this in commit 3df5ad7995 on May 22, 2019
  26. PastaPastaPasta referenced this in commit ba45364394 on May 22, 2019
  27. PastaPastaPasta referenced this in commit 6425bd3c26 on May 23, 2019
  28. PastaPastaPasta referenced this in commit 655c729f48 on May 23, 2019
  29. PastaPastaPasta referenced this in commit 90a4310230 on May 28, 2019
  30. PastaPastaPasta referenced this in commit c3ea234248 on May 28, 2019
  31. PastaPastaPasta referenced this in commit 2fd02f6b15 on May 28, 2019
  32. PastaPastaPasta referenced this in commit 4f25f22e3f on Jun 7, 2019
  33. PastaPastaPasta referenced this in commit 14cbf547cc on Jun 8, 2019
  34. PastaPastaPasta referenced this in commit de06018cd9 on Jun 10, 2019
  35. barrystyle referenced this in commit ebad6f5982 on Jan 22, 2020
  36. MarcoFalke locked this on Sep 8, 2021

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: 2026-04-30 12:15 UTC

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