In preparation for overloading CHECKSIG et al to accept Schnorr
signatures, this changes VerifySignature so that it has knowledge of
SCRIPT_ flags.
The sigcache code (which memoizes VerifySignature positive results) has been
upgraded in accordance. In order that the cache does not fill up with
duplicate entries and cache misses occur due to distinct policy/consensus
flagsets, I have also added an explicit flag-invariants masking so that
irrelevant flag permutations can be ignored.
The order of parameters in sigcache's internal ComputeEntry has been also
changed to mirror VerifySignature, as well as order of hashing.