substitutes "for x in range(N):" by "for _ in range(N):"
indicates to the reader that a block is just repeated N times, and
that the loop counter is not used in the body
Backport notes:
- this PR also replaces a few occurences of range(0, x) with range(x)
- test/functional/p2p_tx_download.py has been included in test/functional/p2p_inv_download.py, and was already up to date
This is a backport of core#19674