The node might crash or disconnect when our mininode waits for data. Due to the crash, the data is guaranteed to never arrive and we can fail early with an assert
test: Fail early on disconnect in mininode.wait_for_* #16470
pull MarcoFalke wants to merge 1 commits into bitcoin:master from MarcoFalke:1907-testMininodeNoWaitOnDisconnect changing 1 files +29 −6-
MarcoFalke commented at 8:13 PM on July 26, 2019: member
-
test: Fail early on disconnect in mininode.wait_for_* fac2e6a604
-
MarcoFalke commented at 8:19 PM on July 26, 2019: member
Example:
2019-07-26T20:11:22.049000Z TestFramework (INFO): Test a re-org of one week's worth of blocks (1088 blocks) [...] node0 2019-07-26T20:14:44.224983Z [msghand] UpdateTip: new best=02a38b39fec53caf38302ad6075fb32f1f5dc52737ac36c60dbfbb11849038c4 height=766 version=0x00000004 log2_work=10.583083 tx=12824 date='2019-07-26T20:22:31Z' progress=1.000000 cache=1.6MiB(12000txo) test 2019-07-26T20:14:58.425000Z TestFramework.mininode (DEBUG): Closed connection to: 127.0.0.1:13931 [...] 2019-07-26T20:14:58.552000Z TestFramework (ERROR): Assertion failed Traceback (most recent call last): File "/root/workspace/bitcoin-core/test/functional/test_framework/test_framework.py", line 193, in main self.run_test() File "./test/functional/feature_block.py", line 1233, in run_test self.send_blocks([block], True, timeout=60*60) File "./test/functional/feature_block.py", line 1365, in send_blocks self.nodes[0].p2p.send_blocks_and_test(blocks, self.nodes[0], success=success, reject_reason=reject_reason, force_send=force_send, timeout=timeout, expect_disconnect=reconnect) File "/root/workspace/bitcoin-core/test/functional/test_framework/mininode.py", line 561, in send_blocks_and_test self.sync_with_ping(timeout=timeout) File "/root/workspace/bitcoin-core/test/functional/test_framework/mininode.py", line 441, in sync_with_ping wait_until(test_function, timeout=timeout, lock=mininode_lock) File "/root/workspace/bitcoin-core/test/functional/test_framework/util.py", line 211, in wait_until if predicate(): File "/root/workspace/bitcoin-core/test/functional/test_framework/mininode.py", line 439, in test_function assert self.is_connected AssertionError 2019-07-26T20:14:58.723000Z TestFramework (INFO): Stopping nodes - DrahtBot added the label Tests on Jul 26, 2019
-
in test/functional/test_framework/mininode.py:432 in fac2e6a604
430 | + 431 | wait_until(test_function, timeout=timeout, lock=mininode_lock) 432 | 433 | def wait_for_verack(self, timeout=60): 434 | - test_function = lambda: self.message_count["verack"] 435 | + def test_function():
promag commented at 10:25 PM on July 28, 2019:Could you explain why not assert here?
MarcoFalke commented at 10:49 PM on July 28, 2019:This is called in
add_p2p_connection, which establishes the connection async. So the assert will fail on the first try.promag commented at 10:25 PM on July 28, 2019: memberConcept ACK, makes sense.
laanwj commented at 1:12 PM on August 1, 2019: memberACK fac2e6a6045e4ddd6b473f4f3ddbb69d9d6921f6
laanwj merged this on Aug 1, 2019laanwj closed this on Aug 1, 2019laanwj referenced this in commit 79816278e2 on Aug 1, 2019MarcoFalke deleted the branch on Aug 1, 2019sidhujag referenced this in commit 3b841f6de9 on Aug 1, 2019jasonbcox referenced this in commit 8fc318140d on Oct 14, 2020linuxsh2 referenced this in commit 281e00f1f5 on Aug 11, 2021DrahtBot locked this on Dec 16, 2021ContributorsLabels
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-17 06:14 UTC
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-17 06:14 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me