From bdf21dd81912b0a9122c9fd72a9db92242ed1ae5 Mon Sep 17 00:00:00 2001 From: Amadeusz Annissimo Date: Thu, 4 Mar 2021 08:11:37 +0100 Subject: [PATCH] Typo fix `len(bin(16))` is 7, not 6. So if we want to get to `4`, we need to have: `len(bin(total))-3` and not: `len(bin(total))-2` --- ch11.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ch11.asciidoc b/ch11.asciidoc index 20ea9f5a..acf32da9 100644 --- a/ch11.asciidoc +++ b/ch11.asciidoc @@ -285,7 +285,7 @@ include::code-ch11/examples.py[tag=example5] ---- <1> Since we halve at every level, log~2~ of the number of leaves is how many levels there are in the Merkle tree. Note we round up using `math.ceil` as we round up for halving at each level. -We could also be clever and use `len(bin(total))-2`. +We could also be clever and use `len(bin(total))-3`. <2> The Merkle tree will hold the root level at index 0, the level below at index 1, and so on. In other words, the index is the "depth" from the top. <3> There are levels 0 to `max_depth` in this Merkle tree.