Skip to content

test: Fix intermittent issues in feature_assumevalid.py#120

Draft
l0rinc wants to merge 5 commits intomasterfrom
detached490
Draft

test: Fix intermittent issues in feature_assumevalid.py#120
l0rinc wants to merge 5 commits intomasterfrom
detached490

Conversation

@l0rinc
Copy link
Copy Markdown
Owner

@l0rinc l0rinc commented Feb 18, 2026

WIP, split bitcoin#34571

Replace `send_blocks_until_disconnected` with explicit block sends up to the invalid block, followed by `wait_for_disconnect()`.

This removes a race where Python can outpace validation and advance the test before the disconnect happens.
Replace inline comments with `self.log.info()` messages for each scenario.
Move p2p setup and other non-log-producing preparation outside `assert_debug_log` blocks.
This keeps each assertion focused on the log-producing actions.
For node0, node1, and node2, check the block-1 assumevalid log in a dedicated scope, then check later logs in a second scope to make assertions more precise and failure output shorter.
Replace polling-based waits with explicit synchronization and direct asserts.

Use `send_and_ping` for non-disconnect paths, add the missing node2 invalid chaintip assertion, and simplify node1 height checking.
# signature so we can pass in the block hash as assumevalid.
self.start_node(0)

def send_blocks_until_disconnected(self, p2p_conn):
Copy link
Copy Markdown
Owner Author

@l0rinc l0rinc Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

45f4ffc:

direct message

for i in range(len(self.blocks)):
if not p2p_conn.is_connected:
break
try:
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

45f4ffc:
pending message

except IOError:
assert not p2p_conn.is_connected
break

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another direct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant