Footnotes to clarify some special conditions which witness scripts will fail @sipa @instagibbs @gmaxwell
BIP141 script failure clarifications #399
pull jl2012 wants to merge 2 commits into bitcoin:master from jl2012:patch-22 changing 1 files +2 −2-
jl2012 commented at 5:36 PM on June 6, 2016: contributor
-
d34877f482
BIP141 script failure clarifications
Footnotes to clarify some special conditions which witness scripts will fail
-
instagibbs commented at 5:48 PM on June 6, 2016: member
great, ACK
-
in bip-0141.mediawiki:None in d34877f482 outdated
97 | @@ -98,9 +98,9 @@ If the version byte is 0, and the witness program is 32 bytes: 98 | * The <code>witnessScript</code> is deserialized, and executed after normal script evaluation with the remaining witness stack (≤ 520 bytes for each stack item). 99 | * The script must not fail, and result in exactly a single TRUE on the stack. 100 | 101 | -If the version byte is 0, but the witness program is neither 20 nor 32 bytes, the script must fail. 102 | +If the version byte is 0, but the witness program is neither 20 nor 32 bytes, the script must fail.<ref>For example, a scriptPubKey with OP_0 followed by a 40-byte non-zero data push will fail due to incorrect program size. However, a scriptPubKey with OP_0 followed by a 41-byte non-zero data push will pass, since it is not considered to be a witness program</ref> 103 | 104 | -If the version byte is 1 to 16, no further interpretation of the witness program or witness happens, and there is no size restriction for the witness. These versions are reserved for future extensions. 105 | +If the version byte is 1 to 16, no further interpretation of the witness program or witness happens, and there is no size restriction for the witness. These versions are reserved for future extensions.<ref>For backward compatibility, for any version byte from 0 to 16, the script must fail if the witness program has a <code>CastToBool</code> value of zero. However, having a hash like this is a successful preimage attack against the hash function, and the risk is negligible.</ref>
sipa commented at 5:50 PM on June 6, 2016:Maybe say: no further size restriction for the witness, besides the 40-byte limit.
instagibbs commented at 5:51 PM on June 6, 2016:This is referring to the witnessScript, AFAIK, not the witness program.
sipa commented at 5:53 PM on June 6, 2016:Oh, indeed.
instagibbs commented at 5:54 PM on June 6, 2016:I had the exact same misinterpretation you did a couple days ago. @jl2012 could we just spell it out?
jl2012 commented at 5:15 AM on June 10, 2016:@sipa @instagibbs revised
BIP141: clarify size restriction for witness stack 7304edc475luke-jr added the label Proposed BIP modification on Jul 15, 2016luke-jr commented at 2:47 PM on July 15, 2016: membersipa commented at 11:57 PM on July 15, 2016: memberACK
luke-jr merged this on Jul 16, 2016luke-jr closed this on Jul 16, 2016Contributors
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:10 UTC
This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-14 11:10 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me