From 685039a7dd0f1b5a5a8bfc9c8bcaae44161457fb Mon Sep 17 00:00:00 2001 From: Forostovec Date: Mon, 26 Jan 2026 13:11:57 +0200 Subject: [PATCH] core/state: avoid empty codehash allocs and needless storage trie opens --- core/state/state_object.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/state/state_object.go b/core/state/state_object.go index 2873c3cb8a..abcec26e03 100644 --- a/core/state/state_object.go +++ b/core/state/state_object.go @@ -90,7 +90,7 @@ type stateObject struct { // empty returns whether the account is considered empty. func (s *stateObject) empty() bool { - return s.data.Nonce == 0 && s.data.Balance.IsZero() && bytes.Equal(s.data.CodeHash, types.EmptyCodeHash.Bytes()) + return s.data.Nonce == 0 && s.data.Balance.IsZero() && bytes.Equal(s.data.CodeHash, types.EmptyCodeHash[:]) } // newObject creates a state object. @@ -535,7 +535,7 @@ func (s *stateObject) Code() []byte { if len(s.code) != 0 { return s.code } - if bytes.Equal(s.CodeHash(), types.EmptyCodeHash.Bytes()) { + if bytes.Equal(s.CodeHash(), types.EmptyCodeHash[:]) { return nil } defer func(start time.Time) { @@ -562,7 +562,7 @@ func (s *stateObject) CodeSize() int { if len(s.code) != 0 { return len(s.code) } - if bytes.Equal(s.CodeHash(), types.EmptyCodeHash.Bytes()) { + if bytes.Equal(s.CodeHash(), types.EmptyCodeHash[:]) { return 0 } defer func(start time.Time) {