mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-15 19:31:37 +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
|
modified = true
|
||||||
postAccount.Nonce = newNonce
|
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 {
|
if t.pre[addr].CodeHash != nil {
|
||||||
prevCodeHash = *t.pre[addr].CodeHash
|
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 {
|
if newCodeHash != prevCodeHash {
|
||||||
modified = true
|
modified = true
|
||||||
// If code was cleared, report the canonical empty code hash
|
postAccount.CodeHash = &newCodeHash
|
||||||
// rather than the zero hash used for comparison.
|
|
||||||
if newCodeHash == (common.Hash{}) {
|
|
||||||
emptyHash := types.EmptyCodeHash
|
|
||||||
postAccount.CodeHash = &emptyHash
|
|
||||||
} else {
|
|
||||||
postAccount.CodeHash = &newCodeHash
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if !t.config.DisableCode {
|
if !t.config.DisableCode {
|
||||||
newCode := t.env.StateDB.GetCode(addr)
|
newCode := t.env.StateDB.GetCode(addr)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue