From 8de65ab10cbdf6ea5509f321f025686e6ab0ecaf Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Tue, 28 Oct 2014 16:03:11 +0100 Subject: certtools.py: fix bug in build_merkle_tree --- tools/certtools.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/certtools.py b/tools/certtools.py index 0ce8885..cbb4ff7 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -264,8 +264,11 @@ def next_merkle_layer(layer): return [internal_hash(pair) for pair in chunks(layer, 2)] def build_merkle_tree(layer0): + if len(layer0) == 0: + return [[hashlib.sha256().digest()]] layers = [] current_layer = layer0 + layers.append(current_layer) while len(current_layer) > 1: current_layer = next_merkle_layer(current_layer) layers.append(current_layer) -- cgit v1.1