Skip to content

Commit f42ca59

Browse files
authored
Merge pull request bitcoin#399 from jl2012/patch-22
BIP141 script failure clarifications
2 parents f275a55 + 7304edc commit f42ca59

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bip-0141.mediawiki

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ If the version byte is 0, and the witness program is 32 bytes:
9898
* The <code>witnessScript</code> is deserialized, and executed after normal script evaluation with the remaining witness stack (≤ 520 bytes for each stack item).
9999
* The script must not fail, and result in exactly a single TRUE on the stack.
100100
101-
If the version byte is 0, but the witness program is neither 20 nor 32 bytes, the script must fail.
101+
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>
102102

103-
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.
103+
If the version byte is 1 to 16, no further interpretation of the witness program or witness stack happens, and there is no size restriction for the witness stack. 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>
104104

105105
=== Other consensus critical limits ===
106106

0 commit comments

Comments
 (0)