test: check that peer is connected when calling sync_*
Summary:
Without a connection there is no way to sync, so we can fail early and don't have to wait for the timeout
This is a backport of Core PR18474
Test Plan: ninja && ninja check-functional-extended
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D8897