mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 13:46:43 +00:00
recreate object if not found in revert
This commit is contained in:
parent
bfba27dd07
commit
a8dbc93a2c
1 changed files with 9 additions and 2 deletions
|
|
@ -110,10 +110,17 @@ func (j *journal) append(entry journalEntry) {
|
|||
func (j *journal) revert(statedb *StateDB, snapshot int) {
|
||||
for i := len(j.entries) - 1; i >= snapshot; i-- {
|
||||
// Undo the changes made by the operation
|
||||
j.entries[i].revert(statedb)
|
||||
entry := j.entries[i]
|
||||
if addr := entry.dirtied(); addr != nil {
|
||||
if statedb.getStateObject(*addr) == nil {
|
||||
// State object was deleted, recreate it for safe reversion
|
||||
statedb.createObject(*addr)
|
||||
}
|
||||
}
|
||||
entry.revert(statedb)
|
||||
|
||||
// Drop any dirty tracking induced by the change
|
||||
if addr := j.entries[i].dirtied(); addr != nil {
|
||||
if addr := entry.dirtied(); addr != nil {
|
||||
if j.dirties[*addr]--; j.dirties[*addr] == 0 {
|
||||
delete(j.dirties, *addr)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue