test: fix StopIteration exception in p2p_node_network_limited.py #29753

pull furszy wants to merge 1 commits into bitcoin:master from furszy:2024_test_fix_p2p_node_network_failure changing 1 files +2 −1
  1. furszy commented at 7:38 PM on March 27, 2024: member

    Fixes #29731

    The next() call throws an exception if the default parameter is omitted and the iterator is exhausted. Fix it by providing a default value.

    The failure can be tested by commenting out lines 90 and 91 in the test (the self.connect_nodes(2, 0)). Since there is no connection, the node in question retrieves a single element in the 'getchaintips()' call. This scenario without the fix, aborts the test right away, throwing an StopIteration exception, and with the fix, the test properly waits until the timeout (wait_until() call).

  2. test: fix StopIteration exception in p2p_node_network_limited.py
    The `next()` call throws an exception if the default parameter is omitted and the iterator is exhausted.
    Fix it by providing a default value.
    
    The failure can be tested by commenting out lines 90 and 91 in the test (the `self.connect_nodes(2, 0)``).
    Since there is no connection, the node in question retrieves a single element in the 'getchaintips()' call.
    This scenario without the fix, aborts the test right away, throwing an StopIteration exception, and with
    the fix, the test properly waits until the timeout (wait_until() call).
    2eb5175de8
  3. DrahtBot commented at 7:38 PM on March 27, 2024: 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, brunoerg, BrandonOdiwuor, tdb3

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

  4. DrahtBot added the label Tests on Mar 27, 2024
  5. maflcko commented at 7:48 PM on March 27, 2024: member

    review ACK 2eb5175de87c798af328de3f2147aac7879eaa10

  6. brunoerg commented at 10:31 AM on March 28, 2024: contributor

    crACK 2eb5175de87c798af328de3f2147aac7879eaa10

  7. BrandonOdiwuor commented at 5:32 PM on March 28, 2024: contributor

    crACK 2eb5175de87c798af328de3f2147aac7879eaa10

  8. tdb3 commented at 8:17 PM on March 28, 2024: contributor

    Tested ACK for 2eb5175de87c798af328de3f2147aac7879eaa10. Pulled, built, ran all unit and functional tests (all passed). Comment out lines 90 and 91 of p2p_node_network_limited.py as discussed in the intro. The test properly waited for the 60 timeout and failed as expected instead of encountering StopIteration.

  9. fanquake merged this on Apr 1, 2024
  10. fanquake closed this on Apr 1, 2024

  11. furszy deleted the branch on Apr 1, 2024
  12. bitcoin locked this on Apr 3, 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-16 00:13 UTC

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