Move the getdata content flush and logging to a lambda
Summary:
This is a little refactor of the code which improves readability and can
be leveraged when introducing the proof inventory type.
Test Plan:
ninja all check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D9592