mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-09 08:43:04 +01:00
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:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user