Refactor p2p_getaddr_caching.py
Summary:
This is a backport of core#19697 [4/4]
https://github.com/bitcoin/bitcoin/pull/19697/commits/0d04784af151de249bbbcbad51e6e8ad9af8f5a3
Depends on D10292
Test Plan: test/functional/test_runner.py p2p_getaddr_caching.py
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D10293