Skip to content

Commit

Permalink
trie: quell linter in commiter.go (ethereum#21329)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet authored Jul 15, 2020
1 parent 6c9f040 commit 240d185
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions trie/committer.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,19 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
// Commit child
collapsed := cn.copy()
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
} else {
collapsed.Val = childV
}
collapsed.Val = childV
}
// The key needs to be copied, since we're delivering it to database
collapsed.Key = hexToCompact(cn.Key)
hashedNode := c.store(collapsed, db, force, true)
if hn, ok := hashedNode.(hashNode); ok {
return hn, nil
} else {
return collapsed, nil
}
return collapsed, nil
case *fullNode:
hashedKids, hasVnodes, err := c.commitChildren(cn, db, force)
if err != nil {
Expand All @@ -130,9 +129,8 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
hashedNode := c.store(collapsed, db, force, hasVnodes)
if hn, ok := hashedNode.(hashNode); ok {
return hn, nil
} else {
return collapsed, nil
}
return collapsed, nil
case valueNode:
return c.store(cn, db, force, false), nil
// hashnodes aren't stored
Expand Down Expand Up @@ -265,7 +263,7 @@ func estimateSize(n node) int {
if child := n.Children[i]; child != nil {
s += estimateSize(child)
} else {
s += 1
s++
}
}
return s
Expand Down

0 comments on commit 240d185

Please sign in to comment.