Skip to content

Commit

Permalink
Add sha256 loop over each bit example
Browse files Browse the repository at this point in the history
  • Loading branch information
xhliu committed Jul 5, 2019
1 parent cdeffa8 commit c0a4234
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/loop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Because `loop unrolling <https://en.wikipedia.org/wiki/Loop_unrolling>`_ is done


If ``maxLoopCount`` is set too small, the contract may not work correctly. If ``maxLoopCount`` is set too large, the resulting script is bloated unnecessarily and costs more to execute.
There are a number of ways to choose the right ``maxLoopCount`` judiciously. One way is to simulate the contract off chain and find the number of loops.
There are a number of ways to choose the right ``maxLoopCount`` judiciously. One way is to simulate the contract off chain and find the number of loops. Another way is to exploit the
characteristics of the looping itself. For example, if a loop iterates over each bit of a ``sha256`` hash, ``maxLoopCount`` is ``256``.

Access loop index
=================
Expand Down

0 comments on commit c0a4234

Please sign in to comment.