Skip to content

Commit 63740b7

Browse files
core/state: reduce allocation in updateStateObject (#31861)
Optimize updateStateObject to reduce an allocation.
1 parent 62aa6b2 commit 63740b7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

core/state/statedb.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,8 @@ func (s *StateDB) GetTransientState(addr common.Address, key common.Hash) common
562562
// updateStateObject writes the given object to the trie.
563563
func (s *StateDB) updateStateObject(obj *stateObject) {
564564
// Encode the account and update the account trie
565-
addr := obj.Address()
566-
if err := s.trie.UpdateAccount(addr, &obj.data, len(obj.code)); err != nil {
567-
s.setError(fmt.Errorf("updateStateObject (%x) error: %v", addr[:], err))
565+
if err := s.trie.UpdateAccount(obj.Address(), &obj.data, len(obj.code)); err != nil {
566+
s.setError(fmt.Errorf("updateStateObject (%x) error: %v", obj.Address(), err))
568567
}
569568
if obj.dirtyCode {
570569
s.trie.UpdateContractCode(obj.Address(), common.BytesToHash(obj.CodeHash()), obj.code)

0 commit comments

Comments
 (0)