HomePhabricator

add flags to VerifySignature and sigcache

Authored by Mark Lundeberg on Jan 28 2019, 23:59.

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

Details

Committed
Mark LundebergJan 29 2019, 00:21
Pushed
markblundebergJan 29 2019, 00:21
Reviewer
Restricted Project
Differential Revision
D2373: add flags to VerifySignature and sigcache
Parents
rABCde86c70c2d6b: Don't use pass by reference to const for cheaply-copied types (bool, char, etc.
Branches
Unknown
Tags
Unknown

Event Timeline

Mark Lundeberg committed rABC4b626647fb93: add flags to VerifySignature and sigcache (authored by Mark Lundeberg).Jan 29 2019, 00:21