Convert VARINT to the formatter/Using approach
Summary:
This is a backport of Core PR17896 [2/3]
https://github.com/bitcoin/bitcoin/pull/17896/commits/2f1b2f4ed044fe005e5a6c1b55e95822e83c16df
Depends on D8626
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D8627