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.
This commit is contained in:
Ava Chow
2026-02-06 12:02:39 -08:00
parent 9ec1ae0e98
commit b73a62f667

View File

@@ -164,6 +164,7 @@ class AssumeValidTest(BitcoinTestFramework):
self.send_blocks_until_disconnected(p2p0)
self.wait_until(lambda: self.nodes[0].getblockcount() >= COINBASE_MATURITY + 1)
assert_equal(self.nodes[0].getblockcount(), COINBASE_MATURITY + 1)
self.wait_until(lambda: next(filter(lambda x: x["hash"] == self.blocks[-1].hash_hex, self.nodes[0].getchaintips()))["status"] == "invalid")
# nodes[1]