mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
cmd, core: polish code
This commit is contained in:
parent
88d9f83692
commit
a676bdea62
2 changed files with 6 additions and 7 deletions
|
|
@ -245,9 +245,10 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
|||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
// TODO (rjl493456442) it's a bit weird to reset the tracer in the
|
||||
// middle of block execution, please improve it somehow.
|
||||
if tracer != nil {
|
||||
vmConfig.Tracer = tracer.Hooks
|
||||
evm.SetConfig(vmConfig)
|
||||
evm.SetTracer(tracer.Hooks)
|
||||
}
|
||||
statedb.SetTxContext(tx.Hash(), txIndex)
|
||||
|
||||
|
|
|
|||
|
|
@ -133,11 +133,9 @@ func NewEVM(blockCtx BlockContext, statedb StateDB, chainConfig *params.ChainCon
|
|||
return evm
|
||||
}
|
||||
|
||||
// SetConfig resets the config and re-initialize the interpreter just in case
|
||||
// some additional EIPs are activated by new config.
|
||||
func (evm *EVM) SetConfig(config Config) {
|
||||
evm.Config = config
|
||||
evm.interpreter = NewEVMInterpreter(evm)
|
||||
// SetTracer sets the tracer for following state transition.
|
||||
func (evm *EVM) SetTracer(tracer *tracing.Hooks) {
|
||||
evm.Config.Tracer = tracer
|
||||
}
|
||||
|
||||
// SetPrecompiles sets the precompiled contracts for the EVM.
|
||||
|
|
|
|||
Loading…
Reference in a new issue