I noticed intermittent failures in the mempool_packages.py RPC test; turns out I introduced a race condition in a recent pull (#7062).
Before this change, node1 could either be in sync or out of sync with node0 after invalidateblock was called, depending on how fast that happened. The test would fail if they were out of sync. This fixes the test by enforcing that their tips stay synced up.
@laanwj Note that this bug is in 0.12, in case you think this should be backported or included in the next 0.12 release candidate.