1 parent b364e52 commit 7214841Copy full SHA for 7214841
1 file changed
testonly/tree.go
@@ -82,16 +82,7 @@ func (t *Tree) Hash() []byte {
82
// HashAt returns the root hash at the given size.
83
// Requires 0 <= size <= Size(), otherwise panics.
84
func (t *Tree) HashAt(size uint64) []byte {
85
- if size == 0 {
86
- return t.hasher.EmptyRoot()
87
- }
88
- hashes := t.getNodes(compact.RangeNodes(0, size, nil))
89
-
90
- hash := hashes[len(hashes)-1]
91
- for i := len(hashes) - 2; i >= 0; i-- {
92
- hash = t.hasher.HashChildren(hashes[i], hash)
93
94
- return hash
+ return t.SubtreeHashAt(0, size)
95
}
96
97
// SubtreeHashAt returns the root hash of the [start, end) subtree.
0 commit comments