Refactor the loop that validate each transaction in a block to reduce code duplication.
Summary:
The check that need to be done for the coinbase are somewhat different than the one required for other transactions. In order to work around this, the loop makes the check that are common for both types of txns, and then increment, check end of loop and do the checks that do not apply to coinbase.
This ensure that checks for regular transaction only run after one increment, so won't run on the coinbase. The downside is that it require to break the loop in the middle of it rather than at the same place as the entry point. This is worthy tradeof, IMO.
Test Plan:
make check ../qa/pull-tester/rpc-tests.py -extended
Reviewers: freetrader, sickpig, #bitcoin_abc
Reviewed By: freetrader, #bitcoin_abc
Differential Revision: https://reviews.bitcoinabc.org/D126