Intermittent failure in rpc_invalidateblock.py assert_equal(self.nodes[0].getblockchaininfo()[‘headers’], 7) [ AssertionError: not(24 == 7)] #32965

issue maflcko openend this issue on July 14, 2025
  1. maflcko commented at 7:03 am on July 14, 2025: member

    https://github.com/bitcoin/bitcoin/actions/runs/16238294537/job/45851271663?pr=32954#step:13:3105

     0 test  2025-07-12T13:43:20.090739Z TestFramework (ERROR): Assertion failed 
     1                                   Traceback (most recent call last):
     2                                     File "D:\a\bitcoin\bitcoin\build\test\functional\test_framework\test_framework.py", line 195, in main
     3                                       self.run_test()
     4                                       ~~~~~~~~~~~~~^^
     5                                     File "D:\a\bitcoin\bitcoin\build\test\functional\rpc_invalidateblock.py", line 137, in run_test
     6                                       assert_equal(self.nodes[0].getblockchaininfo()['headers'], 7)
     7                                       ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     8                                     File "D:\a\bitcoin\bitcoin\build\test\functional\test_framework\util.py", line 78, in assert_equal
     9                                       raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
    10                                   AssertionError: not(24 == 7)
    
  2. maflcko added the label CI failed on Jul 14, 2025
  3. stratospher commented at 9:21 am on July 14, 2025: contributor

    2025-07-12T13:43:21.8573662Z node1 2025-07-12T13:43:20.090914Z [msghand] [D:\a\bitcoin\bitcoin\src\net.cpp:3870] [void __cdecl CConnman::PushMessage(class CNode *,struct CSerializedNetMsg &&)] [net] sending block (260 bytes) peer=0 2025-07-12T13:43:21.8574419Z node0 2025-07-12T13:43:20.091379Z [msghand] [D:\a\bitcoin\bitcoin\src\net_processing.cpp:5939] [bool __cdecl `anonymous-namespace’::PeerManagerImpl::SendMessages(class CNode *)] [net] Requesting block 72876656a1468aa0784c5624a377651fb3e5055671d7ced16833ed1d7cbca044 (21) peer=0

    oh node1 (which has 24 blocks) is causing node0 (which has 6 blocks + 7 headers) to silently reorg. disconnecting node0 and node1 so that they don’t exchange blocks should fix this. will open a PR.

  4. stratospher commented at 9:53 am on July 14, 2025: contributor
        # Reconsider the header
        self.nodes[0].reconsiderblock(block.hash)
        import time; time.sleep(200)
        # Since header doesn't have block data, it can't be chain tip
        # Check if it's possible for an ancestor (with block data) to be the chain tip
        assert_equal(self.nodes[0].getbestblockhash(), blockhash_6)
        assert_equal(self.nodes[0].getblockchaininfo()['blocks'], 6)
        assert_equal(self.nodes[0].getblockchaininfo()['headers'], 7)
    

    I am not sure why they started exchanging blocks in the CI failure job though. when I put a 200s sleep in the test locally, node0 and node1 didn’t exchange any message.

  5. maflcko commented at 9:54 am on July 14, 2025: member
    You can test this by replacing the newly added disconnect_nodes in your fix with self.nodes[0].reconsiderblock(block.hash).
  6. fanquake closed this on Jul 15, 2025

  7. fanquake referenced this in commit 0087ba409b on Jul 15, 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: 2025-07-23 12:12 UTC

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