Skip to content

Commit 24d4622

Browse files
sysvmVM
andauthored
trie: spelling - fix comments in hasher (#28507)
Co-authored-by: VM <[email protected]>
1 parent e803ef0 commit 24d4622

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

trie/hasher.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,19 @@ func (h *hasher) hash(n node, force bool) (hashed node, cached node) {
8484
}
8585
return hashed, cached
8686
default:
87-
// Value and hash nodes don't have children so they're left as were
87+
// Value and hash nodes don't have children, so they're left as were
8888
return n, n
8989
}
9090
}
9191

9292
// hashShortNodeChildren collapses the short node. The returned collapsed node
9393
// holds a live reference to the Key, and must not be modified.
94-
// The cached
9594
func (h *hasher) hashShortNodeChildren(n *shortNode) (collapsed, cached *shortNode) {
9695
// Hash the short node's child, caching the newly hashed subtree
9796
collapsed, cached = n.copy(), n.copy()
9897
// Previously, we did copy this one. We don't seem to need to actually
9998
// do that, since we don't overwrite/reuse keys
100-
//cached.Key = common.CopyBytes(n.Key)
99+
// cached.Key = common.CopyBytes(n.Key)
101100
collapsed.Key = hexToCompact(n.Key)
102101
// Unless the child is a valuenode or hashnode, hash it
103102
switch n.Val.(type) {
@@ -153,7 +152,7 @@ func (h *hasher) shortnodeToHash(n *shortNode, force bool) node {
153152
return h.hashData(enc)
154153
}
155154

156-
// shortnodeToHash is used to creates a hashNode from a set of hashNodes, (which
155+
// fullnodeToHash is used to create a hashNode from a fullNode, (which
157156
// may contain nil values)
158157
func (h *hasher) fullnodeToHash(n *fullNode, force bool) node {
159158
n.encode(h.encbuf)
@@ -203,7 +202,7 @@ func (h *hasher) proofHash(original node) (collapsed, hashed node) {
203202
fn, _ := h.hashFullNodeChildren(n)
204203
return fn, h.fullnodeToHash(fn, false)
205204
default:
206-
// Value and hash nodes don't have children so they're left as were
205+
// Value and hash nodes don't have children, so they're left as were
207206
return n, n
208207
}
209208
}

0 commit comments

Comments
 (0)