mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-05-20 23:09:27 +00:00
trie: return hasher to pool (#18116)
* trie: return hasher to pool * trie: minor code formatting fix
This commit is contained in:
parent
ffe2fc3bc4
commit
68be45e5f8
2 changed files with 4 additions and 0 deletions
|
|
@ -181,6 +181,8 @@ func (it *nodeIterator) LeafProof() [][]byte {
|
||||||
if len(it.stack) > 0 {
|
if len(it.stack) > 0 {
|
||||||
if _, ok := it.stack[len(it.stack)-1].node.(valueNode); ok {
|
if _, ok := it.stack[len(it.stack)-1].node.(valueNode); ok {
|
||||||
hasher := newHasher(0, 0, nil)
|
hasher := newHasher(0, 0, nil)
|
||||||
|
defer returnHasherToPool(hasher)
|
||||||
|
|
||||||
proofs := make([][]byte, 0, len(it.stack))
|
proofs := make([][]byte, 0, len(it.stack))
|
||||||
|
|
||||||
for i, item := range it.stack[:len(it.stack)-1] {
|
for i, item := range it.stack[:len(it.stack)-1] {
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,8 @@ func (t *Trie) Prove(key []byte, fromLevel uint, proofDb ethdb.Putter) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hasher := newHasher(0, 0, nil)
|
hasher := newHasher(0, 0, nil)
|
||||||
|
defer returnHasherToPool(hasher)
|
||||||
|
|
||||||
for i, n := range nodes {
|
for i, n := range nodes {
|
||||||
// Don't bother checking for errors here since hasher panics
|
// Don't bother checking for errors here since hasher panics
|
||||||
// if encoding doesn't work and we're not writing to any database.
|
// if encoding doesn't work and we're not writing to any database.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue