diff options
author | gary rong <garyrong0905@gmail.com> | 2017-11-27 19:34:17 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2017-11-27 19:34:17 +0800 |
commit | 0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8 (patch) | |
tree | cfa15a1910da65ba8a051180a7f5cb546fc7eabf /trie/secure_trie.go | |
parent | e4c9fd29a3907367b2b6b7cd32b0098350a94741 (diff) | |
download | go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar.gz go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar.bz2 go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar.lz go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar.xz go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.tar.zst go-tangerine-0f7fbb85d6e939510a3e3bb6493a9a332ddfd8e8.zip |
trie: make fullnode children hash calculation concurrently (#15131)
* trie: make fullnode children hash calculation concurrently
* trie: thread out only on topmost fullnode
* trie: clean up full node children hash calculation
* trie: minor code fixups
Diffstat (limited to 'trie/secure_trie.go')
-rw-r--r-- | trie/secure_trie.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/trie/secure_trie.go b/trie/secure_trie.go index 20c303f31..1fde45165 100644 --- a/trie/secure_trie.go +++ b/trie/secure_trie.go @@ -199,10 +199,10 @@ func (t *SecureTrie) secKey(key []byte) []byte { // invalid on the next call to hashKey or secKey. func (t *SecureTrie) hashKey(key []byte) []byte { h := newHasher(0, 0) - h.sha.Reset() - h.sha.Write(key) - buf := h.sha.Sum(t.hashKeyBuf[:0]) - returnHasherToPool(h) + calculator := h.newCalculator() + calculator.sha.Write(key) + buf := calculator.sha.Sum(t.hashKeyBuf[:0]) + h.returnCalculator(calculator) return buf } |