@@ -179,11 +179,12 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
179179 }
180180 snapshot := evm .StateDB .Snapshot ()
181181 p , isPrecompile := evm .Precompile (addr )
182+ debug := evm .Config .Tracer != nil
182183
183184 if ! evm .StateDB .Exist (addr ) {
184185 if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
185186 // Calling a non existing account, don't do anything, but ping the tracer
186- if evm . Config . Debug {
187+ if debug {
187188 if evm .depth == 0 {
188189 evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
189190 evm .Config .Tracer .CaptureEnd (ret , 0 , nil )
@@ -199,7 +200,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
199200 evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
200201
201202 // Capture the tracer start/end events in debug mode
202- if evm . Config . Debug {
203+ if debug {
203204 if evm .depth == 0 {
204205 evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
205206 defer func (startGas uint64 ) { // Lazy evaluation of the parameters
@@ -270,7 +271,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
270271 snapshot := evm .StateDB .Snapshot ()
271272
272273 // Invoke tracer hooks that signal entering/exiting a call frame
273- if evm .Config .Debug {
274+ if evm .Config .Tracer != nil {
274275 evm .Config .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
275276 defer func (startGas uint64 ) {
276277 evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -311,7 +312,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
311312 snapshot := evm .StateDB .Snapshot ()
312313
313314 // Invoke tracer hooks that signal entering/exiting a call frame
314- if evm .Config .Debug {
315+ if evm .Config .Tracer != nil {
315316 // NOTE: caller must, at all times be a contract. It should never happen
316317 // that caller is something other than a Contract.
317318 parent := caller .(* Contract )
@@ -365,7 +366,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
365366 evm .StateDB .AddBalance (addr , big0 )
366367
367368 // Invoke tracer hooks that signal entering/exiting a call frame
368- if evm .Config .Debug {
369+ if evm .Config .Tracer != nil {
369370 evm .Config .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
370371 defer func (startGas uint64 ) {
371372 evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -449,7 +450,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
449450 contract := NewContract (caller , AccountRef (address ), value , gas )
450451 contract .SetCodeOptionalHash (& address , codeAndHash )
451452
452- if evm .Config .Debug {
453+ if evm .Config .Tracer != nil {
453454 if evm .depth == 0 {
454455 evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
455456 } else {
@@ -492,7 +493,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
492493 }
493494 }
494495
495- if evm .Config .Debug {
496+ if evm .Config .Tracer != nil {
496497 if evm .depth == 0 {
497498 evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , err )
498499 } else {
0 commit comments