diff --git a/core/state/statedb.go b/core/state/statedb.go index 195e463c28..24783766cc 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 common.Hash{} + return types.EmptyRootHash } // 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.Hash{} + if stateObject != nil { + return common.BytesToHash(stateObject.CodeHash()) } - return common.BytesToHash(stateObject.CodeHash()) + return types.EmptyCodeHash } // GetState retrieves a value from the given account's storage trie.