mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 06:06:44 +00:00
[bug fix] Avoid concurrent access to hasher buffer
This commit is contained in:
parent
84fd09a04c
commit
a20f0aa1b6
1 changed files with 4 additions and 4 deletions
|
|
@ -79,7 +79,7 @@ func newStateReader(root common.Hash, snaps *snapshot.Tree) (*stateReader, error
|
|||
//
|
||||
// The returned account might be nil if it's not existent.
|
||||
func (r *stateReader) Account(addr common.Address) (*types.StateAccount, error) {
|
||||
ret, err := r.snap.Account(crypto.HashData(r.buff, addr.Bytes()))
|
||||
ret, err := r.snap.Account(crypto.HashData(crypto.NewKeccakState(), addr.Bytes()))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -109,8 +109,8 @@ func (r *stateReader) Account(addr common.Address) (*types.StateAccount, error)
|
|||
//
|
||||
// The returned storage slot might be empty if it's not existent.
|
||||
func (r *stateReader) Storage(addr common.Address, key common.Hash) (common.Hash, error) {
|
||||
addrHash := crypto.HashData(r.buff, addr.Bytes())
|
||||
slotHash := crypto.HashData(r.buff, key.Bytes())
|
||||
addrHash := crypto.HashData(crypto.NewKeccakState(), addr.Bytes())
|
||||
slotHash := crypto.HashData(crypto.NewKeccakState(), key.Bytes())
|
||||
ret, err := r.snap.Storage(addrHash, slotHash)
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
|
|
@ -223,7 +223,7 @@ func (r *trieReader) Storage(addr common.Address, key common.Hash) (common.Hash,
|
|||
root = r.subRoots[addr]
|
||||
}
|
||||
var err error
|
||||
tr, err = trie.NewStateTrie(trie.StorageTrieID(r.root, crypto.HashData(r.buff, addr.Bytes()), root), r.db)
|
||||
tr, err = trie.NewStateTrie(trie.StorageTrieID(r.root, crypto.HashData(crypto.NewKeccakState(), addr.Bytes()), root), r.db)
|
||||
if err != nil {
|
||||
return common.Hash{}, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue