Skip to content

Commit

Permalink
eth/tracers: fix the issue of pointer compare
Browse files Browse the repository at this point in the history
Signed-off-by: Delweng <delweng@gmail.com>
  • Loading branch information
jsvisa committed Sep 28, 2022
1 parent 9817c78 commit 3e09d38
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions eth/tracers/native/prestate.go
Expand Up @@ -191,17 +191,17 @@ func (t *prestateTracer) CaptureTxEnd(restGas uint64) {
newNonce := t.env.StateDB.GetNonce(addr)
newCode := t.env.StateDB.GetCode(addr)

if newBalance.Cmp(t.pre[addr].Balance) == 0 {
if newBalance.Cmp(t.pre[addr].Balance) != 0 {
modified = true
t.post[addr].Balance = newBalance
postAccount.Balance = newBalance
}
if newNonce != t.pre[addr].Nonce {
modified = true
postAccount.Nonce = newNonce
}
if !bytes.Equal(newCode, t.pre[addr].Code) {
modified = true
t.post[addr].Code = newCode
postAccount.Code = newCode
}

for key, val := range state.Storage {
Expand Down Expand Up @@ -229,7 +229,7 @@ func (t *prestateTracer) CaptureTxEnd(restGas uint64) {
// the new created contracts' prestate were empty, so delete them
for a := range t.created {
// the created contract maybe exists in statedb before the creating tx
if s := t.pre[a]; s.Balance == "0x0" && len(s.Storage) == 0 && s.Code == "0x" {
if s := t.pre[a]; s.Balance.Cmp(big.NewInt(0)) == 0 && len(s.Storage) == 0 && len(s.Code) == 0 {
delete(t.pre, a)
}
}
Expand Down

0 comments on commit 3e09d38

Please sign in to comment.