Skip to content

Commit 8bf0565

Browse files
author
Darioush Jalali
authored
trie: remove unused makeHashNode (#24702)
1 parent bb5633c commit 8bf0565

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

trie/committer.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import (
2222
"sync"
2323

2424
"github.com/ethereum/go-ethereum/common"
25-
"github.com/ethereum/go-ethereum/crypto"
26-
"golang.org/x/crypto/sha3"
2725
)
2826

2927
// leafChanSize is the size of the leafCh. It's a pretty arbitrary number, to allow
@@ -44,18 +42,14 @@ type leaf struct {
4442
// By 'some level' of parallelism, it's still the case that all leaves will be
4543
// processed sequentially - onleaf will never be called in parallel or out of order.
4644
type committer struct {
47-
sha crypto.KeccakState
48-
4945
onleaf LeafCallback
5046
leafCh chan *leaf
5147
}
5248

5349
// committers live in a global sync.Pool
5450
var committerPool = sync.Pool{
5551
New: func() interface{} {
56-
return &committer{
57-
sha: sha3.NewLegacyKeccak256().(crypto.KeccakState),
58-
}
52+
return &committer{}
5953
},
6054
}
6155

@@ -236,14 +230,6 @@ func (c *committer) commitLoop(db *Database) {
236230
}
237231
}
238232

239-
func (c *committer) makeHashNode(data []byte) hashNode {
240-
n := make(hashNode, c.sha.Size())
241-
c.sha.Reset()
242-
c.sha.Write(data)
243-
c.sha.Read(n)
244-
return n
245-
}
246-
247233
// estimateSize estimates the size of an rlp-encoded node, without actually
248234
// rlp-encoding it (zero allocs). This method has been experimentally tried, and with a trie
249235
// with 1000 leafs, the only errors above 1% are on small shortnodes, where this

0 commit comments

Comments
 (0)