[avalanche] Factorize the inflight request timeout handling
Summary:
This diff extracts a lambda that can be used with any kind of vote items, for now blocks and proofs.
Ref T1854.
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Subscribers: deadalnix
Maniphest Tasks: T1854
Differential Revision: https://reviews.bitcoinabc.org/D10384