From 4f2b554b35b002894db5e3a1590e8a2b9a34fb9c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 27 Sep 2016 11:22:43 +0200 Subject: [PATCH] trie: fixup iterator --- trie/iterator.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/trie/iterator.go b/trie/iterator.go index 44d33aeab2..8cad51aff4 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -127,11 +127,11 @@ func (it *NodeIterator) step() error { if len(it.stack) == 0 { // Initialize the iterator if we've just started. root := it.trie.Hash() - it.stack = append(it.stack, &nodeIteratorState{ - hash: root, - node: it.trie.root, - child: -1, - }) + state := &nodeIteratorState{node: it.trie.root, child: -1} + if root != emptyRoot { + state.hash = root + } + it.stack = append(it.stack, state) } else { // Continue iterating at the previous node otherwise. it.stack = it.stack[:len(it.stack)-1]