test: Fix intermittent failure in feature_assumevalid.py by ensuring invalid block was processed before checking debug.log #34528

pull achow101 wants to merge 1 commits into bitcoin:master from achow101:fix-test-assuemvalid-block-script changing 1 files +1 −0
  1. achow101 commented at 10:07 pm on February 6, 2026: member

    Prior to merging a PR, I run 4 different build configurations and their tests in parallel, and consistently one of those will have feature_assumevalid.py fail. The failure is because the assert_debug_log context exits before the invalid block is processed, so the lines it is looking for don’t appear in the part of the log that it is examining.

    This PR should resolve that issue by waiting for getchaintips to report that the invalid chain is invalid before exiting the assert_debug_log context.

  2. test: Ensure invalid block was processed before checking debug.log
    In feature_assumevalid.py, we check that a modified block 102 is invalid
    by asserting a message in the debug.log. However, this can
    intermittently fail as exiting the assert_debug_log can occur before the
    block has actually been validated, thus causing the test to fail as the
    validation error message is not present in the chunk of the debug.log
    being examined.
    
    We can wait for the block to make an invalid chain tip to ensure that the log
    line will be present.
    b73a62f667
  3. DrahtBot added the label Tests on Feb 6, 2026
  4. DrahtBot commented at 10:07 pm on February 6, 2026: contributor

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

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK l0rinc, sedited

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. l0rinc approved
  6. l0rinc commented at 10:28 pm on February 6, 2026: contributor

    tested ACK b73a62f667d0220a5700a02e11736684d2214b04

    I often encounter this failure locally (especially for higher parallelism), thanks for fixing it. I have tested it by running the same test multiple times, and repeated the before/after behavior multiple times to make sure the pattern is clear:

    0rm -rfd build && cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBUILD_BENCH=ON && ninja -C build -j$(nproc) && \
    1build/test/functional/test_runner.py -j20 feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py feature_assumevalid.py
    

    Before 8bb77f348ef390b7f7c7fb6b57fdc7e86ddb4ce7:

     0TEST                   | STATUS    | DURATION
     1
     2feature_assumevalid.py |  Passed  | 26 s
     3feature_assumevalid.py |  Passed  | 28 s                                                                                                                                                        
     4feature_assumevalid.py |  Passed  | 28 s                                                                                                                                                        
     5feature_assumevalid.py |  Passed  | 28 s                                                                                                                                                        
     6feature_assumevalid.py |  Passed  | 28 s                                                                                                                                                        
     7feature_assumevalid.py |  Passed  | 28 s                                                                                                                                                        
     8feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
     9feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    10feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    11feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    12feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    13feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    14feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    15feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    16feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    17feature_assumevalid.py |  Passed  | 29 s                                                                                                                                                        
    18feature_assumevalid.py |  Passed  | 25 s                                                                                                                                                        
    19feature_assumevalid.py |  Failed  | 7 s                                                                                                                                                         
    20feature_assumevalid.py |  Failed  | 7 s                                                                                                                                                         
    21feature_assumevalid.py |  Failed  | 7 s                                                                                                                                                         
    22feature_assumevalid.py |  Failed  | 7 s                                                                                                                                                         
    23                                                                                                                                                                                                 
    24ALL                    |  Failed  | 509 s (accumulated)
    

    After 8f5fe239389923babdeb9dd9f9993301cce8a56c (rebased locally):

     0TEST                   | STATUS    | DURATION
     1
     2feature_assumevalid.py |  Passed  | 32 s
     3feature_assumevalid.py |  Passed  | 32 s                                                                                                                                                        
     4feature_assumevalid.py |  Passed  | 32 s                                                                                                                                                        
     5feature_assumevalid.py |  Passed  | 32 s                                                                                                                                                        
     6feature_assumevalid.py |  Passed  | 33 s                                                                                                                                                        
     7feature_assumevalid.py |  Passed  | 33 s                                                                                                                                                        
     8feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
     9feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    10feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    11feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    12feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    13feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    14feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    15feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    16feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    17feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    18feature_assumevalid.py |  Passed  | 35 s                                                                                                                                                        
    19feature_assumevalid.py |  Passed  | 36 s                                                                                                                                                        
    20feature_assumevalid.py |  Passed  | 36 s                                                                                                                                                        
    21feature_assumevalid.py |  Passed  | 36 s                                                                                                                                                        
    22feature_assumevalid.py |  Passed  | 18 s                                                                                                                                                        
    23                                                                                                                                                                                                 
    24ALL                    |  Passed  | 705 s (accumulated) 
    
  7. sedited approved
  8. sedited commented at 1:57 pm on February 7, 2026: contributor

    ACK b73a62f667d0220a5700a02e11736684d2214b04

    I haven’t run into this failure in a while, but the change looks fine either way.

  9. sedited merged this on Feb 7, 2026
  10. sedited closed this on Feb 7, 2026

  11. in test/functional/feature_assumevalid.py:167 in b73a62f667
    163@@ -164,6 +164,7 @@ def run_test(self):
    164             self.send_blocks_until_disconnected(p2p0)
    165             self.wait_until(lambda: self.nodes[0].getblockcount() >= COINBASE_MATURITY + 1)
    166             assert_equal(self.nodes[0].getblockcount(), COINBASE_MATURITY + 1)
    167+            self.wait_until(lambda: next(filter(lambda x: x["hash"] == self.blocks[-1].hash_hex, self.nodes[0].getchaintips()))["status"] == "invalid")
    


    maflcko commented at 10:38 am on February 12, 2026:

    This looks like the wrong fix, and it is also incomplete:

    • It is wrong, because send_blocks_until_disconnected should wait until the disconnect (it does not), so the real bug is in send_blocks_until_disconnected.
    • The same fix is needed for nodes[2] below

    Fixed both issues in https://github.com/bitcoin/bitcoin/pull/34571

  12. maflcko commented at 10:38 am on February 12, 2026: member
    lgtm. Seems fine, but i think it is incomplete

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-02-17 06:13 UTC

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