masher: Port the wait_for_sync method