From 7f68752bee6b259878f81c29dab4e9d1ec5f738f Mon Sep 17 00:00:00 2001
From: Gregory Sanders <gsanders87@gmail.com>
Date: Tue, 19 Jan 2016 11:48:15 -0500
Subject: Tidy up Witness Program section

---
 bip-0141.mediawiki | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

(limited to 'bip-0141.mediawiki')

diff --git a/bip-0141.mediawiki b/bip-0141.mediawiki
index 4614822..c769abd 100644
--- a/bip-0141.mediawiki
+++ b/bip-0141.mediawiki
@@ -57,21 +57,17 @@ If there are more than one scriptPubKey matching the pattern, the one with highe
 
 A scriptPubKey (or redeemScript as defined in BIP16/P2SH) that consists of a 1-byte push opcode (for 0 to 16) followed by a data push between 2 and 32 bytes gets a new special meaning. The value of the first push is called the "version byte". The following byte vector pushed is called the "witness program".
 
-Witness verification logic is either
-# triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program, or
-# triggered when a scriptPubKey is a P2SH script, and the BIP16 redeemScript pushed in the scriptSig is exactly a push of a version byte plus a push of a witness program.
+There are two cases in which witness validation logic are triggered. Each case determines the location of the witness version byte and program, as well as the form of the scriptSig:
+# Triggered by a scriptPubKey that is exactly a push of a version byte, plus a push of a witness program. The scriptSig must be exactly empty.
+# Triggered when a scriptPubKey is a P2SH script, and the BIP16 redeemScript pushed in the scriptSig is exactly a push of a version byte plus a push of a witness program. The scriptSig must be exactly a push of the BIP16 redeemScript.
 
-New rules for scriptSig:
-* In case 1, the scriptSig must be exactly empty.
-* In case 2, the scriptSig must be exactly a push of the BIP16 redeemScript.
-
-If the version byte is 0, and the witness program is 20 bytes,
+If the version byte is 0, and the witness program is 20 bytes:
 * It is interpreted as a pay-to-witness-public-key-hash (P2WPKH) program.
-* The witness must consist of exactly 2 items. The first one is a signature, and the second one is a public key.
-* HASH160 of the public key must match the 20-byte witness program.
+* The witness must consist of exactly 2 items. The first one a signature, and the second one a public key.
+* The HASH160 of the public key must match the 20-byte witness program.
 * After normal script evaluation, the signature is verified against the public key with CHECKSIG operation. The verification must result in a single TRUE on the stack.
 
-If the version byte is 0, and the witness program is 32 bytes,
+If the version byte is 0, and the witness program is 32 bytes:
 * It is interpreted as a pay-to-witness-script-hash (P2WSH) program.
 * The witness must consist of an input stack to feed to the script, followed by a serialized script ("witnessScript").
 * The witnessScript is popped off the initial witness stack. SHA256 of the witnessScript must match the 32-byte witness program.
-- 
cgit v1.2.3

