mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-16 11:51:35 +00:00
fix origin code hash
This commit is contained in:
parent
c698661f7f
commit
a5aee0d2a8
1 changed files with 6 additions and 5 deletions
|
|
@ -169,10 +169,11 @@ func (s *BALStateTransition) commitAccount(addr common.Address) (*accountUpdate,
|
||||||
)
|
)
|
||||||
op := &accountUpdate{
|
op := &accountUpdate{
|
||||||
address: addr,
|
address: addr,
|
||||||
data: types.SlimAccountRLP(*s.postStates[addr]), // TODO: cache the updated state acocunt somewhere
|
data: types.SlimAccountRLP(*s.postStates[addr]), // TODO: cache the updated state account somewhere
|
||||||
}
|
}
|
||||||
if prestate, exist := s.prestates.Load(addr); exist {
|
var prestate *types.StateAccount
|
||||||
prestate := prestate.(*types.StateAccount)
|
if ps, exist := s.prestates.Load(addr); exist {
|
||||||
|
prestate = ps.(*types.StateAccount)
|
||||||
op.origin = types.SlimAccountRLP(*prestate)
|
op.origin = types.SlimAccountRLP(*prestate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -181,10 +182,10 @@ func (s *BALStateTransition) commitAccount(addr common.Address) (*accountUpdate,
|
||||||
hash: crypto.Keccak256Hash(s.diffs[addr].Code),
|
hash: crypto.Keccak256Hash(s.diffs[addr].Code),
|
||||||
blob: s.diffs[addr].Code,
|
blob: s.diffs[addr].Code,
|
||||||
}
|
}
|
||||||
if op.origin == nil {
|
if prestate == nil {
|
||||||
code.originHash = types.EmptyCodeHash
|
code.originHash = types.EmptyCodeHash
|
||||||
} else {
|
} else {
|
||||||
code.originHash = crypto.Keccak256Hash(op.origin)
|
code.originHash = common.BytesToHash(prestate.CodeHash)
|
||||||
}
|
}
|
||||||
op.code = &code
|
op.code = &code
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue