forked from cerc-io/plugeth
Avoid unnecessary RLP encoding
While looking for the source of a memory leak, I decided to optimize the metatracer to avoid encoding values when there weren't any tracers configured to received the encoded values. I also avoided putting the EVM into debug mode when there weren't any tracers configured. None of these fixed the memory leak, but they still seem like good practices. Memory leak fix is in the next commit.
This commit is contained in:
@@ -71,9 +71,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||
misc.ApplyDAOHardFork(statedb)
|
||||
}
|
||||
blockContext := NewEVMBlockContext(header, p.bc, nil)
|
||||
blockTracer := pluginGetBlockTracer(header.Hash(), statedb)
|
||||
cfg.Tracer = blockTracer
|
||||
cfg.Debug = true
|
||||
blockTracer, ok := pluginGetBlockTracer(header.Hash(), statedb)
|
||||
if ok {
|
||||
cfg.Tracer = blockTracer
|
||||
cfg.Debug = true
|
||||
}
|
||||
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, p.config, cfg)
|
||||
// Iterate over and process the individual transactions
|
||||
pluginPreProcessBlock(block)
|
||||
|
||||
Reference in New Issue
Block a user