scratch space: use single allocation
Summary:
- scratch: add magic bytes to beginning of structure
- scratch space: thread error_callback into all scratch space functions
Use it when checking magic bytes
- scratch: unify allocations
- scratch: rename max_size to size, document that extra will actually be allocated
- scratch: save a couple bytes of unnecessarily-allocated memory
- scratch: replace frames with "checkpoint" system
This is a backport of secp256k1 PR600
Test Plan:
ninja check-secp256k1
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D5146