Split up key and script metadata for better type safety
Summary:
Refactoring only, no functional change
Backport of core PR11854
Test Plan:
make check ./test/functional/test_runner.py
Reviewers: #bitcoin_abc, deadalnix, jasonbcox
Reviewed By: #bitcoin_abc, jasonbcox
Subscribers: teamcity, schancel
Differential Revision: https://reviews.bitcoinabc.org/D2415