Skip to content

Commit 240d185

Browse files
authored
trie: quell linter in commiter.go (#21329)
1 parent 6c9f040 commit 240d185

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

trie/committer.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,20 +105,19 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
105105
// Commit child
106106
collapsed := cn.copy()
107107
if _, ok := cn.Val.(valueNode); !ok {
108-
if childV, err := c.commit(cn.Val, db, false); err != nil {
108+
childV, err := c.commit(cn.Val, db, false)
109+
if err != nil {
109110
return nil, err
110-
} else {
111-
collapsed.Val = childV
112111
}
112+
collapsed.Val = childV
113113
}
114114
// The key needs to be copied, since we're delivering it to database
115115
collapsed.Key = hexToCompact(cn.Key)
116116
hashedNode := c.store(collapsed, db, force, true)
117117
if hn, ok := hashedNode.(hashNode); ok {
118118
return hn, nil
119-
} else {
120-
return collapsed, nil
121119
}
120+
return collapsed, nil
122121
case *fullNode:
123122
hashedKids, hasVnodes, err := c.commitChildren(cn, db, force)
124123
if err != nil {
@@ -130,9 +129,8 @@ func (c *committer) commit(n node, db *Database, force bool) (node, error) {
130129
hashedNode := c.store(collapsed, db, force, hasVnodes)
131130
if hn, ok := hashedNode.(hashNode); ok {
132131
return hn, nil
133-
} else {
134-
return collapsed, nil
135132
}
133+
return collapsed, nil
136134
case valueNode:
137135
return c.store(cn, db, force, false), nil
138136
// hashnodes aren't stored
@@ -265,7 +263,7 @@ func estimateSize(n node) int {
265263
if child := n.Children[i]; child != nil {
266264
s += estimateSize(child)
267265
} else {
268-
s += 1
266+
s++
269267
}
270268
}
271269
return s

0 commit comments

Comments
 (0)