From 9e5ebed0d59c598ed1b28477b2ada0b45ba7ad14 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Tue, 7 Nov 2023 08:33:59 +0800 Subject: [PATCH] Revert "core/state: return empty hash root instead of zero" This reverts commit bf7d3a35c13c7cfea554623d35017f2a0e6597b0. Signed-off-by: jsvisa --- core/state/statedb.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/state/statedb.go b/core/state/statedb.go index 24783766cc..195e463c28 100644 --- a/core/state/statedb.go +++ b/core/state/statedb.go @@ -305,7 +305,7 @@ func (s *StateDB) GetStorageRoot(addr common.Address) common.Hash { if stateObject != nil { return stateObject.Root() } - return types.EmptyRootHash + return common.Hash{} } // TxIndex returns the current transaction index set by Prepare. @@ -331,10 +331,10 @@ func (s *StateDB) GetCodeSize(addr common.Address) int { func (s *StateDB) GetCodeHash(addr common.Address) common.Hash { stateObject := s.getStateObject(addr) - if stateObject != nil { - return common.BytesToHash(stateObject.CodeHash()) + if stateObject == nil { + return common.Hash{} } - return types.EmptyCodeHash + return common.BytesToHash(stateObject.CodeHash()) } // GetState retrieves a value from the given account's storage trie.