Merge #12780: Reduce variable scopes
Summary:
6a318e48a6 Reduce variable scopes (practicalswift)
Pull request description:
Reduce variable scopes.
Tree-SHA512: 5c7735344024cb6cd310e739886dc811a64b640a0d6aac8b3d04f49e5987d6ff6676d978890bc84f1460527d92217176a79b007f0bf6b4147c04abfec2c67714
Backport of Core PR12780
https://github.com/bitcoin/bitcoin/pull/12780/files
Test Plan: make check
Reviewers: #bitcoin_abc, deadalnix, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D3774