trie: quell linter in commiter.go (#21329)
This commit is contained in:
parent
6c9f040ebe
commit
240d1851db
@ -105,20 +105,19 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
|
|||||||
// Commit child
|
// Commit child
|
||||||
collapsed := cn.copy()
|
collapsed := cn.copy()
|
||||||
if _, ok := cn.Val.(valueNode); !ok {
|
if _, ok := cn.Val.(valueNode); !ok {
|
||||||
if childV, err := c.commit(cn.Val, db, false); err != nil {
|
childV, err := c.commit(cn.Val, db, false)
|
||||||
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else {
|
|
||||||
collapsed.Val = childV
|
|
||||||
}
|
}
|
||||||
|
collapsed.Val = childV
|
||||||
}
|
}
|
||||||
// The key needs to be copied, since we're delivering it to database
|
// The key needs to be copied, since we're delivering it to database
|
||||||
collapsed.Key = hexToCompact(cn.Key)
|
collapsed.Key = hexToCompact(cn.Key)
|
||||||
hashedNode := c.store(collapsed, db, force, true)
|
hashedNode := c.store(collapsed, db, force, true)
|
||||||
if hn, ok := hashedNode.(hashNode); ok {
|
if hn, ok := hashedNode.(hashNode); ok {
|
||||||
return hn, nil
|
return hn, nil
|
||||||
} else {
|
|
||||||
return collapsed, nil
|
|
||||||
}
|
}
|
||||||
|
return collapsed, nil
|
||||||
case *fullNode:
|
case *fullNode:
|
||||||
hashedKids, hasVnodes, err := c.commitChildren(cn, db, force)
|
hashedKids, hasVnodes, err := c.commitChildren(cn, db, force)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -130,9 +129,8 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
|
|||||||
hashedNode := c.store(collapsed, db, force, hasVnodes)
|
hashedNode := c.store(collapsed, db, force, hasVnodes)
|
||||||
if hn, ok := hashedNode.(hashNode); ok {
|
if hn, ok := hashedNode.(hashNode); ok {
|
||||||
return hn, nil
|
return hn, nil
|
||||||
} else {
|
|
||||||
return collapsed, nil
|
|
||||||
}
|
}
|
||||||
|
return collapsed, nil
|
||||||
case valueNode:
|
case valueNode:
|
||||||
return c.store(cn, db, force, false), nil
|
return c.store(cn, db, force, false), nil
|
||||||
// hashnodes aren't stored
|
// hashnodes aren't stored
|
||||||
@ -265,7 +263,7 @@ func estimateSize(n node) int {
|
|||||||
if child := n.Children[i]; child != nil {
|
if child := n.Children[i]; child != nil {
|
||||||
s += estimateSize(child)
|
s += estimateSize(child)
|
||||||
} else {
|
} else {
|
||||||
s += 1
|
s++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return s
|
return s
|
||||||
|
Loading…
Reference in New Issue
Block a user