Skip to content

Conversation

mstampfer
Copy link

Improve the invalid block version rejection test to verify the debug log contains the expected 'bad-version' rejection message, matching the pattern used in feature_dersig.py and feature_cltv.py.

Changes:

  • Add msg_block import for direct P2P message sending
  • Replace send_blocks() helper with assert_debug_log() context manager
  • Send invalid block via send_message() and wait for peer disconnection
  • Explicitly verify chain tip hasn't advanced after rejection
  • Add reconnect_p2p() call after peer disconnection

This ensures the test verifies both P2P-level rejection and the internal logging behavior from ContextualCheckBlockHeader() in validation.cpp.

Improve the invalid block version rejection test to verify the debug log
contains the expected 'bad-version' rejection message, matching the pattern
used in feature_dersig.py and feature_cltv.py.

Changes:
- Add msg_block import for direct P2P message sending
- Replace send_blocks() helper with assert_debug_log() context manager
- Send invalid block via send_message() and wait for peer disconnection
- Explicitly verify chain tip hasn't advanced after rejection
- Add reconnect_p2p() call after peer disconnection

This ensures the test verifies both P2P-level rejection and the internal
logging behavior from ContextualCheckBlockHeader() in validation.cpp.
@mstampfer mstampfer marked this pull request as draft October 4, 2025 17:00
@mstampfer mstampfer marked this pull request as ready for review October 11, 2025 11:36
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