Limit scope of all global std::once_flag
Summary:
once_flag is a helper (as the name might suggest) to execute a callable only once. Thus, the scope of the flag does never need to extend beyond where the callable is called. Typically this is function scope.
Move all the flags to function scope to
simplify code review avoid mistakes where similarly named flags are accidentally exchanged avoid polluting the global scope
This is a backport of core#19111
Depends on D9260
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, majcosta
Reviewed By: #bitcoin_abc, majcosta
Differential Revision: https://reviews.bitcoinabc.org/D9264