Refactor the whole SIGHASH_FORKID mechanism.
Summary: There was some code repeatition and overall, the structure could be improved.
Test Plan:
make check ../qa/pull-tester/rpc-tests.py -extended
Updated test according to code changes.
Reviewers: freetrader, #bitcoin_abc, kyuupichan
Reviewed By: #bitcoin_abc, kyuupichan
Subscribers: kyuupichan
Differential Revision: https://reviews.bitcoinabc.org/D341