I think this provides useful information when the wait_until()
fails.
Without this change:
02018-03-19T18:29:56.324000Z TestFramework (ERROR): Assertion failed
1Traceback (most recent call last):
2 File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 126, in main
3 self.run_test()
4 File "./feature_block.py", line 502, in run_test
5 self.sync_blocks([b40], False, 16, b'bad-blk-sigops', reconnect=True)
6 File "./feature_block.py", line 1315, in sync_blocks
7 self.nodes[0].p2p.send_blocks_and_test(blocks, self.nodes[0], success=success, reject_code=reject_code, reject_reason=reject_reason, request_block=request_block, timeout=timeout)
8 File "/home/ubuntu/bitcoin/test/functional/test_framework/mininode.py", line 553, in send_blocks_and_test
9 wait_until(lambda: self.reject_code_received == reject_code, lock=mininode_lock, timeout=1)
10 File "/home/ubuntu/bitcoin/test/functional/test_framework/util.py", line 222, in wait_until
11 assert_greater_than(timeout, time.time())
12 File "/home/ubuntu/bitcoin/test/functional/test_framework/util.py", line 42, in assert_greater_than
13 raise AssertionError("%s <= %s" % (str(thing1), str(thing2)))
14AssertionError: 1521484196.279766 <= 1521484196.3246927
With this change:
02018-03-19T18:27:45.353000Z TestFramework (INFO): Reject a block with too many P2SH sigops
12018-03-19T18:27:48.557000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ([' wait_until(lambda: self.reject_code_received == reject_code, lock=mininode_lock, timeout=1)\n'], 553)
22018-03-19T18:27:48.557000Z TestFramework (ERROR): Assertion failed
3Traceback (most recent call last):
4 File "/home/ubuntu/bitcoin/test/functional/test_framework/test_framework.py", line 126, in main
5 self.run_test()
6 File "./feature_block.py", line 502, in run_test
7 self.sync_blocks([b40], False, 16, b'bad-blk-sigops', reconnect=True)
8 File "./feature_block.py", line 1315, in sync_blocks
9 self.nodes[0].p2p.send_blocks_and_test(blocks, self.nodes[0], success=success, reject_code=reject_code, reject_reason=reject_reason, request_block=request_block, timeout=timeout)
10 File "/home/ubuntu/bitcoin/test/functional/test_framework/mininode.py", line 553, in send_blocks_and_test
11 wait_until(lambda: self.reject_code_received == reject_code, lock=mininode_lock, timeout=1)
12 File "/home/ubuntu/bitcoin/test/functional/test_framework/util.py", line 227, in wait_until
13 raise AssertionError("Predicate {} not true after {} seconds".format(predicate_source, timeout))
14AssertionError: Predicate ([' wait_until(lambda: self.reject_code_received == reject_code, lock=mininode_lock, timeout=1)\n'], 553) not true after 1 seconds