Skip to content

Commit

Permalink
doc: document HTLC 2drop optimization.
Browse files Browse the repository at this point in the history
We can save an opcode in both HTLC send and receive scripts by using
OP_2DROP instead of OP_DROP twice.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Aug 7, 2015
1 parent 08ae4a6 commit 88ca0c9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions doc/deployable-lightning.lyx
Original file line number Diff line number Diff line change
Expand Up @@ -1906,23 +1906,20 @@ OP_ELSE Must be A, after HTLC has timed out.
\begin_inset space ~
\end_inset

OP_CHECKLOCKTIMEVERIFY
\begin_inset space ~
\end_inset

OP_DROP Ensure (absolute) time has passed.
OP_CHECKLOCKTIMEVERIFY Ensure (absolute) time has passed.
\end_layout

\begin_layout Description
<DELAY>
\begin_inset space ~
\end_inset

OP_CHECKSEQUENCEVERIFY
\begin_inset space ~
\end_inset
OP_CHECKSEQUENCEVERIFY Delay gives B enough time to use revocation if it
has it.
\end_layout

OP_DROP Delay gives B enough time to use revocation if it has it.
\begin_layout Description
OP_2DROP Drop the delay and htlc-timeout from the stack.
\end_layout

\begin_layout Description
Expand Down Expand Up @@ -1963,20 +1960,17 @@ OP_IF
\end_layout

\begin_deeper
\begin_layout Description
OP_DROP Remove extra hash
\end_layout

\begin_layout Description
<DELAY>
\begin_inset space ~
\end_inset

OP_CHECKSEQUENCEVERIFY
\begin_inset space ~
\end_inset
OP_CHECKSEQUENCEVERIFY Delay gives A enough time to use revocation if it
has it.
\end_layout

OP_DROP Delay gives A enough time to use revocation if it has it.
\begin_layout Description
OP_2DROP Drop extra hash and delay from the stack
\end_layout

\begin_layout Description
Expand Down
Binary file modified doc/deployable-lightning.pdf
Binary file not shown.

0 comments on commit 88ca0c9

Please sign in to comment.