trie: cleaner logic, one less func call

release/1.8
Péter Szilágyi 7 years ago
parent fbf57d53e2
commit d31802312a
No known key found for this signature in database
GPG Key ID: E9AE538CEDF8293D
  1. 4
      trie/hasher.go

@ -196,12 +196,12 @@ func (h *hasher) store(n node, db *Database, force bool) (node, error) {
if h.onleaf != nil {
switch n := n.(type) {
case *shortNode:
if child, ok := n.Val.(valueNode); ok {
if child, ok := n.Val.(valueNode); ok && child != nil {
h.onleaf(child, hash)
}
case *fullNode:
for i := 0; i < 16; i++ {
if child, ok := n.Children[i].(valueNode); ok {
if child, ok := n.Children[i].(valueNode); ok && child != nil {
h.onleaf(child, hash)
}
}

Loading…
Cancel
Save