diff --git a/trie/iterator.go b/trie/iterator.go index 5338aed8e7..ae4a1956f4 100644 --- a/trie/iterator.go +++ b/trie/iterator.go @@ -563,6 +563,9 @@ func reachedPath(path, target []byte) bool { return bytes.Compare(path, target) >= 0 } +// A value embedded in a fullNode occupies its last child slot, but we want to visit it last to +// produce a pre-order traversal. These two functions handle the ordering by mapping index 0 to the +// value, and shifting the indices of children over by 1. func prevChildIndex(index int) int { switch index { case 0: