I opened an issue a while ago on this topic: https://github.com/bitcoin/bitcoin/issues/26113
On Sat, Feb 15, 2025 at 01:13:24PM -0800, Antoine Riard wrote:
> Hi Peter,
>
> I'm talking about this check in VerifyScript as of commit 43e71f74 in
> bitcoin core.
>
> ```
> if ((flags & SCRIPT_VERIFY_SIGPUSHONLY) != 0 &&
> !scriptSig.IsPushOnly()) {
> return set_error(serror, SCRIPT_ERR_SIG_PUSHONLY);
> }
> ```
>
> In my understanding, we never set SCRIPT_VERIFY_SIGPUSHONLY, neither in
> MANDATORY_SCRIPT_VERIFY_FLAGS,
> nor in STANDARD_SCRIPT_VERIFY_FLAGS, and this sounds okay as it's a script
> check pertaining to BIP62
> rule 2, and BIP62 was never activated. As far as I can tell, that's more a
> stale check just right
> there in the interpreter code paths.
Right. So the unused code is just those three lines and the single line
defining SCRIPT_VERIFY_SIGPUSHONLY in script (plus four lines of test
code); IsPushOnly() itself *is* used elsewhere in consensus.
You could opena pull-req to remove that if you want. But the tests of
SCRIPT_VERIFY_SIGPUSHONLY indirectly test IsPushOnly(), so not
immediately clear if that's actually a good idea.
--
https://petertodd.org 'peter'[:-1]@petertodd.org