mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 09:51:36 +00:00
simplify
This commit is contained in:
parent
34042f2e64
commit
fe799fa653
1 changed files with 4 additions and 14 deletions
|
|
@ -266,25 +266,15 @@ func (t *prestateTracer) processDiffState() {
|
|||
modified = true
|
||||
postAccount.Nonce = newNonce
|
||||
}
|
||||
prevCodeHash := common.Hash{}
|
||||
// Empty code hashes are excluded from the prestate, so default
|
||||
// to EmptyCodeHash to match what GetCodeHash returns for codeless accounts.
|
||||
prevCodeHash := types.EmptyCodeHash
|
||||
if t.pre[addr].CodeHash != nil {
|
||||
prevCodeHash = *t.pre[addr].CodeHash
|
||||
}
|
||||
// Empty code hashes are excluded from the prestate. Normalize
|
||||
// the empty code hash to a zero hash to make it comparable.
|
||||
if newCodeHash == types.EmptyCodeHash {
|
||||
newCodeHash = common.Hash{}
|
||||
}
|
||||
if newCodeHash != prevCodeHash {
|
||||
modified = true
|
||||
// If code was cleared, report the canonical empty code hash
|
||||
// rather than the zero hash used for comparison.
|
||||
if newCodeHash == (common.Hash{}) {
|
||||
emptyHash := types.EmptyCodeHash
|
||||
postAccount.CodeHash = &emptyHash
|
||||
} else {
|
||||
postAccount.CodeHash = &newCodeHash
|
||||
}
|
||||
postAccount.CodeHash = &newCodeHash
|
||||
}
|
||||
if !t.config.DisableCode {
|
||||
newCode := t.env.StateDB.GetCode(addr)
|
||||
|
|
|
|||
Loading…
Reference in a new issue