mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 10:50:44 +00:00
parent
4c5d1bd95e
commit
e24293a49c
2 changed files with 3 additions and 23 deletions
|
|
@ -789,27 +789,6 @@ func (s *StateDB) SetTxContext(thash common.Hash, ti int) {
|
||||||
s.txIndex = ti
|
s.txIndex = ti
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSuicides flags the self-destructed objects for deletion so that it
|
|
||||||
// won't be referenced again when called / queried up on.
|
|
||||||
//
|
|
||||||
// DeleteSuicides should not be used for consensus related updates
|
|
||||||
// under any circumstances.
|
|
||||||
func (s *StateDB) DeleteSuicides() {
|
|
||||||
// Reset refund so that any used-gas calculations can use this method.
|
|
||||||
s.clearJournalAndRefund()
|
|
||||||
|
|
||||||
for addr := range s.stateObjectsDirty {
|
|
||||||
stateObject := s.stateObjects[addr]
|
|
||||||
|
|
||||||
// If the object has been removed by a suicide
|
|
||||||
// flag the object as deleted.
|
|
||||||
if stateObject.selfDestructed {
|
|
||||||
stateObject.deleted = true
|
|
||||||
}
|
|
||||||
delete(s.stateObjectsDirty, addr)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *StateDB) clearJournalAndRefund() {
|
func (s *StateDB) clearJournalAndRefund() {
|
||||||
s.journal = newJournal()
|
s.journal = newJournal()
|
||||||
s.validRevisions = s.validRevisions[:0]
|
s.validRevisions = s.validRevisions[:0]
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,7 @@ func (api *DebugAPI) traceChain(ctx context.Context, start, end *types.Block, co
|
||||||
log.Warn("Tracing failed", "hash", tx.Hash(), "block", task.block.NumberU64(), "err", err)
|
log.Warn("Tracing failed", "hash", tx.Hash(), "block", task.block.NumberU64(), "err", err)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
task.statedb.DeleteSuicides()
|
task.statedb.Finalise(true)
|
||||||
task.results[i] = &txTraceResult{Result: res}
|
task.results[i] = &txTraceResult{Result: res}
|
||||||
}
|
}
|
||||||
// Stream the result back to the user or abort on teardown
|
// Stream the result back to the user or abort on teardown
|
||||||
|
|
@ -818,6 +818,7 @@ func (api *DebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, reexec uin
|
||||||
totalFeeUsed = totalFeeUsed.Add(totalFeeUsed, fee)
|
totalFeeUsed = totalFeeUsed.Add(totalFeeUsed, fee)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
statedb.DeleteSuicides()
|
// Ensure any modifications are committed to the state
|
||||||
|
statedb.Finalise(true)
|
||||||
return nil, vm.BlockContext{}, nil, fmt.Errorf("tx index %d out of range for block %x", txIndex, blockHash)
|
return nil, vm.BlockContext{}, nil, fmt.Errorf("tx index %d out of range for block %x", txIndex, blockHash)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue