HomePhabricator

add flags to VerifySignature and sigcache

Description

add flags to VerifySignature and sigcache

Summary:
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 the order in VerifySignature, as well as order of hashing.

Test Plan: Added testset for flag invariance/variance in cache. I played around with adding/removing flags to this test module (and sigcache.cpp) to see how it fails in both directions.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: teamcity, schancel

Maniphest Tasks: T527

Differential Revision: https://reviews.bitcoinabc.org/D2373