The new p2p_handshake test requires that limited nodes are not peered with when the node's system time exceeds ~ 24h of the node's chaintip timestamp, as per PeerManagerImpl::GetDesirableServiceFlags.
By patching this test to modify the timestamp of the chaintip as opposed to mocking the node's system time, we make it resilient to future commits where the node raises a warning if it detects its system time is too much out of sync with its outbound peers.
Resolves a silent merge conflict in #29623, that is changing the warning behaviour when significant time differences with outbound peers are detected, failing the test as it's currently in master.
Considerations/alternatives I've thought of:
- could add
self.setup_clean_chain = Truetoself.set_test_params(), to avoid creating a new tip with a (much) older date, but it doesn't seem to matter? - could avoid using
setmocktimealtogether and instead usecreate_blockinstead, but that seems like it'll be a lot more verbose and I don't think it's worth it?
Big thanks to theStack for his time in discussing this with me offline.