HomePhabricator

Refactor the loop that validate each transaction in a block to reduce code…

Description

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

Details

Provenance
deadalnixAuthored on Jun 8 2017, 18:10
deadalnixPushed on Jun 8 2017, 23:11
Reviewer
Restricted Project
Differential Revision
Restricted Differential Revision
Parents
rABCa1c370d4d79e: Nit in transaction_tests.cpp
Branches
Unknown
Tags
Unknown