Skip to content

Commit 54294b4

Browse files
authored
Merge pull request #16803 from karalabe/trie-avoid-funccall
trie: cleaner logic, one less func call
2 parents 55b579e + d318023 commit 54294b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

trie/hasher.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@ func (h *hasher) store(n node, db *Database, force bool) (node, error) {
196196
if h.onleaf != nil {
197197
switch n := n.(type) {
198198
case *shortNode:
199-
if child, ok := n.Val.(valueNode); ok {
199+
if child, ok := n.Val.(valueNode); ok && child != nil {
200200
h.onleaf(child, hash)
201201
}
202202
case *fullNode:
203203
for i := 0; i < 16; i++ {
204-
if child, ok := n.Children[i].(valueNode); ok {
204+
if child, ok := n.Children[i].(valueNode); ok && child != nil {
205205
h.onleaf(child, hash)
206206
}
207207
}

0 commit comments

Comments
 (0)