Page MenuHomePhabricator

[backport#18388] Make VerifyWitnessProgram use a Span stack
ClosedPublic

Authored by majcosta on Sat, Nov 21, 15:03.

Details

Summary

2b0fcff7f26d59fed4bcafd1602325122a206c67 Make VerifyWitnessProgram use a Span stack (Pieter Wuille)

Pull request description:

Here is a follow-up to #18002, again with the goal of simplifying (potential) BIP341 code.

Instead of passing a begin and end iterator of the initial stack to `ExecuteWitnessScript`, they are turned into a `Span<const valtype>`, representing a span of `valtype`s in memory. This allows `VerifyWitnessProgram` to operate on that span directly, instead of juggling iterators around (which would be exacerbated by #17977 if trying to avoid copying the stack).

Ignored the SegWit stuff but brought in the Span functionality, might be
used in the future also less merge conflicts

Backport of Core PR18388

Test Plan
ninja

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.