Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always check scripts with P2SH + Segwit #499

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

domob1812
Copy link

Upstream Bitcoin Core now enforces P2SH + Segwit + Taproot for all script verification, including old blocks, except for two blocks that actually fail those checks. On Namecoin, P2SH + Segwit (but not Taproot) are active for a long time as well, and actually all historic blocks validate with those rules according to my tests.

This change updates the code to enforce P2SH + Segwit for all scripts, independent of the fork activation. That simplifies things and brings the code more in line with upstream.

P2SH and Segwit have been activated on Namecoin for a long time now.
Upstream Bitcoin enforces those script flags (plus Taproot which is not
yet active on Namecoin) now unconditionally on the full block history,
except for certain specific blocks that would fail.

In Namecoin, actually all old blocks validate with P2SH and Segwit.  Thus
this changes GetBlockScriptFlags to always turn on P2SH and Segwit, which
tidies up / simplifies things and also brings the code more in line with
upstream.
Since script verification enforces segwit always now (without taking
activation into account), we can no longer check for cases where
transactions breaking segwit would be allowed pre-activation.

This simplifies name_segwit.py, and makes it now just double-check that
segwit is indeed enforced as it should be, as well as that generally
names on segwit addresses work.
@domob1812
Copy link
Author

Note that I think the first of the two commits should actually be merged directly to auxpow, while the second one will obviously need to be merged in master afterwards. This PR is meant to illustrate the proposal and not be merged directly.

@domob1812
Copy link
Author

@JeremyRand please take a look, let me know what you think, and help double-check that I'm not doing something stupid here (like accidentally turning off segwit, although the regtest would catch that).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant