[avalanche] Make proper use of p2p_lock in avalanche tests
Summary: The avalanche getavaaddr functional test has been flaky on CI. It appears that in some of the avalanche tests, the p2p_lock is not held properly which is a possible cause of this flakiness. The lock is required for accessing the last_message and message_count attributes of the peer object, so it requires either to lock p2p_lock or to use the P2PInterface.wait_until() method which does it already.
Test Plan:
./test/functional/test_runner.py abc_p2p_getavaaddr abc_p2p_compactproofs
Reviewers: #bitcoin_abc, PiRK
Reviewed By: #bitcoin_abc, PiRK
Differential Revision: https://reviews.bitcoinabc.org/D11653