From 3c612dd22956597af3dcd79eaec1f37412a28f53 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Nov 2016 13:26:22 +1030 Subject: [PATCH] 03-transactions: fix script formatting. Signed-off-by: Rusty Russell --- 03-transactions.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/03-transactions.md b/03-transactions.md index 667f9c4..47c8ef5 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -45,15 +45,15 @@ This output sends funds to the other peer, thus is a simple P2PKH to ` OP_SWAP - OP_SIZE 32 OP_EQUAL + OP_SWAP + OP_SIZE 32 OP_EQUAL OP_NOTIF - # To me via HTLC-timeout tx (timelocked). - OP_DROP 2 OP_SWAP 2 OP_CHECKMULTISIGVERIFY + # To me via HTLC-timeout tx (timelocked). + OP_DROP 2 OP_SWAP 2 OP_CHECKMULTISIGVERIFY OP_ELSE - # To you with preimage. - OP_HASH160 OP_EQUALVERIFY - OP_CHECKSIGVERIFY + # To you with preimage. + OP_HASH160 OP_EQUALVERIFY + OP_CHECKSIGVERIFY OP_ENDIF The remote node can redeem the HTLC with the scriptsig: @@ -98,7 +98,9 @@ These HTLC transactions are almost identical, except the HTLC-Timeout transactio * txin[0] witness stack: ` 0` (HTLC-Timeout) or ` ` (HTLC-success). * txout count: 1 * txout[0] amount: the HTLC amount minus fees (see below) - * txout[0] script: version 0 P2WSH with witness script: + * txout[0] script: version 0 P2WSH with witness script as below. + +The witness script for the output is: OP_IF # Penalty transaction @@ -111,7 +113,6 @@ These HTLC transactions are almost identical, except the HTLC-Timeout transactio OP_ENDIF OP_CHECKSIG - To spend this via penalty, the remote node uses a witness stack ` 1` and to collect the output the local node uses an input with nSequence `to-self-delay` and a witness stack ` 0` # Key Derivation