In commit "test: fix waitTipChanged timeout on slow hosts in interface_ipc_mining" (9b6dadb39c22bfb6d8b8040519316768919ff906)
This PR fixes only one of two places with the same race. This waitNext call waits for an event the test triggers after wait_and_do's 0.1s sleep, just like the "Mine a block" waitTipChanged call the commit fixes, and its timeout is also default_ipc_timeout (1 second with the default --timeout-factor). If the sleep, the RPC and the mempool update together take more than a second, waitNext times out and assert template6 is not None fails. I checked this by passing sleep_time=1.2 to this wait_and_do call, which makes the test fail at that assert.
The faketime repro only catches the waitTipChanged case because the two methods use different clocks: waitTipChanged measures its deadline with the steady clock, which faketime leaves running at real speed, while waitNext uses the wall clock, which faketime slows down along with the sleep, so the deadline stretches too and the test still passes.
Could use the long timeout here as well. It might be simplest to set it once in run_test next to default_ipc_timeout:
# Timeout for waits that should return early because of an event the test
# triggers, long enough not to expire on a slow host.
self.long_ipc_timeout = max(self.default_ipc_timeout, 60000.0) # at least 1 minute
and use it for both waitTipChanged calls, this wait, and the existing max(self.default_ipc_timeout, 60000.0) in wait_for_block(). The template2 wait (2000.0 * timeout_factor with a 1.1 * timeout_factor sleep) has a similar but smaller window and could use it too, since it ignores fees and only returns for the tip update.