test: maxuploadtarget: check for mempool msg disconnect if limit is reached, improve existing test coverage #28996

pull theStack wants to merge 3 commits into bitcoin:master from theStack:202312-test-verify_maxupload_target_state changing 1 files +45 −9
  1. theStack commented at 6:13 PM on December 4, 2023: contributor

    This PR improves existing and adds new test coverage for the -maxuploadtarget mechanism (feature_maxuploadtarget.py) in the following ways, one commit each:

  2. DrahtBot commented at 6:14 PM on December 4, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, sr-gi, achow101

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    No conflicts as of last run.

  3. DrahtBot added the label Tests on Dec 4, 2023
  4. DrahtBot added the label CI failed on Jan 16, 2024
  5. theStack force-pushed on Jan 22, 2024
  6. DrahtBot removed the label CI failed on Jan 22, 2024
  7. DrahtBot added the label CI failed on Jan 31, 2024
  8. test: verify `-maxuploadtarget` limit state via `getnettotals` RPC result 73d7372115
  9. test: check for specific disconnect reasons in feature_maxuploadtarget.py
    This ensures that the disconnect happens for the expected reason and
    also makes it easier to navigate between implementation and test code,
    i.e. both the questions "do we have test coverage for this disconnect?"
    (from an implementation reader's perspective) and "where is the code
    handling this disconnect?" (from a test reader's perspective) can be
    answered simply by grep-ping the corresponding debug message.
    dd5cf38818
  10. test: check that mempool msgs lead to disconnect if uploadtarget is reached
    Note that another reason for disconnect after receiving a MEMPOOL msg of a peer
    is if bloom filters are disabled on the node. This case is covered in the
    functional test `p2p_nobloomfilter_messages.py`.
    b58f009d95
  11. theStack force-pushed on Feb 5, 2024
  12. DrahtBot removed the label CI failed on Feb 5, 2024
  13. maflcko commented at 9:22 AM on February 6, 2024: member

    lgtm ACK b58f009d9585aab775998644de07e27e2a4a8045

  14. glozow requested review from sr-gi on Feb 6, 2024
  15. in test/functional/feature_maxuploadtarget.py:161 in b58f009d95
     160 | @@ -139,23 +161,32 @@ def run_test(self):
     161 |          p2p_conns[2].sync_with_ping()
    


    sr-gi commented at 6:38 PM on February 6, 2024:

    This is sort of unrelated, but it may be worth bringing it in given we are updating this test anyway. The line right above this mentions that the time is advanced by 24 hours and then the checks are performed again. However, the time is actually advance 48 hours: it was previously set to 48 hours in the past, and now it's set to the current time.

    I guess it wouldn't hurt to also define SECONDS_PER_DAY = 60*60*24 for readability throughout the test.

  16. in test/functional/feature_maxuploadtarget.py:181 in b58f009d95
     178 |          peer = self.nodes[0].add_p2p_connection(TestP2PConn())
     179 |  
     180 | +        # Sending mempool message shouldn't disconnect peer, as total limit isn't reached yet
     181 | +        peer.send_and_ping(msg_mempool())
     182 | +
     183 |          #retrieve 20 blocks which should be enough to break the 1MB limit
    


    sr-gi commented at 6:57 PM on February 6, 2024:

    nit: whitespace + caps here

    PS: idk why this was pinned here, I meant L181

  17. sr-gi commented at 7:01 PM on February 6, 2024: member

    tACK b58f009

  18. achow101 commented at 12:22 AM on February 9, 2024: member

    ACK b58f009d9585aab775998644de07e27e2a4a8045

  19. achow101 merged this on Feb 9, 2024
  20. achow101 closed this on Feb 9, 2024

  21. theStack deleted the branch on Feb 9, 2024
  22. bitcoin locked this on Feb 8, 2025

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-14 21:13 UTC

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