This change introduces a new script verification flag, SCRIPT_ENABLE_MAGNETIC_OPCODES, to control the validity of the opcodes that will be introduced or re-enabled in the Magnetic upgrade (scheduled for November 15, 2018).
When this flag is set, the opcodes will be valid, when it is clear the opcodes are not valid. New opcodes, such as OP_CHECKDATASIG, will not exist if the flag is clear. Re-enabled opcodes, such as OP_MUL, will remain disabled if the flag is clear.
The current list of opcodes that will probably be covered by the Magnetic upgrade include: OP_CHECKDATASIG, OP_CHECKDATASIGVERIFY, OP_MUL, OP_INVERT, OP_2MUL, OP_2DIV, OP_LSHIFT, OP_RSHIFT.
The SCRIPT_ENABLE_MAGNETIC_OPCODES flag replaces the previous SCRIPT_ENABLE_CHECKDATASIG flag that was specific to the CHECKDATASIG operations. We suggest that the STANDARD_CHECKDATASIG_VERIFY_FLAGS flag, defined in src/policy/policy.h, is renamed to STANDARD_MAGNETIC_VERIFY_FLAGS or similar, but this is out of scope for this change and should be implemented in conjunction with the other changes that are taking place for the CHECKDATASIG opcodes.
This change includes the definition of the "MAGNETIC_OPCODES" flag name for use in script_tests.json and also adds tests to script_tests.json which verify that the targetted opcodes remain disabled when the flag is set.
The setting of the SCRIPT_ENABLE_MAGNETIC_OPCODES flag to the correct value dependent on block height, or whatever other mechanism, is out of scope of this change.
The change is structured to set the scene for future changes that will implement the targeted opcodes.