This allows an optional tx_invalid.json parameter at position 3 with the format:
0[{"if_unset": ["A", "D"], "then_unset": ["B", "C"]}]
During the one-by-one flag mutation (patched in #22948 to be all combinations, hence the support of multiple) which checks that if disable required flags ["A", "D"]
are all unset then the flags ["B", "C"]
should become unset as well. The unsetting logic loops until the flags are unset (so rules like if_unset A then_unset B and if_unset B then_unset D end up with B and D unset if A is unset and B is set initially).
The current use case of this modification is:
0[{"if_unset": ["DEFAULT_CHECK_TEMPLATE_VERIFY_HASH"], "then_unset": ["DISCOURAGE_UPGRADABLE_NOPS"]}]
This allows us to write use cases wherein we expect DEFAULT_CHECK_TEMPLATE_VERIFY_HASH to be enabled for the tx to be invalid, but desire for it to be valid (and not discouraged) when it is off. After activation of such a soft fork, we can remove such a rule.
We do not want to do this via a TrimFlags rule as it should not happen across all transactions, only the ones we specify.
It would also be possible to have a list of allowed unsettable flags (e.g., just DISCOURAGE_UPGRADABLE_NOPS and other standardness rules), but it is not required. While the allowing of multiple rules is perhaps extra, this keeps the format flexible for future needs.