Merge pull request #16803 from karalabe/trie-avoid-funccall

trie: cleaner logic, one less func call
This commit is contained in:
Péter Szilágyi 2018-05-24 15:54:00 +03:00 committed by GitHub
commit 54294b45b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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)
}
}