@@ -182,11 +182,12 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
182182	}
183183	snapshot  :=  evm .StateDB .Snapshot ()
184184	p , isPrecompile  :=  evm .precompile (addr )
185+ 	debug  :=  evm .Config .Tracer  !=  nil 
185186
186187	if  ! evm .StateDB .Exist (addr ) {
187188		if  ! isPrecompile  &&  evm .chainRules .IsEIP158  &&  value .Sign () ==  0  {
188189			// Calling a non existing account, don't do anything, but ping the tracer 
189- 			if  evm . Config . Debug  {
190+ 			if  debug  {
190191				if  evm .depth  ==  0  {
191192					evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
192193					evm .Config .Tracer .CaptureEnd (ret , 0 , nil )
@@ -202,7 +203,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
202203	evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
203204
204205	// Capture the tracer start/end events in debug mode 
205- 	if  evm . Config . Debug  {
206+ 	if  debug  {
206207		if  evm .depth  ==  0  {
207208			evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
208209			defer  func (startGas  uint64 ) { // Lazy evaluation of the parameters 
@@ -272,7 +273,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
272273	var  snapshot  =  evm .StateDB .Snapshot ()
273274
274275	// Invoke tracer hooks that signal entering/exiting a call frame 
275- 	if  evm .Config .Debug  {
276+ 	if  evm .Config .Tracer   !=   nil  {
276277		evm .Config .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
277278		defer  func (startGas  uint64 ) {
278279			evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -313,7 +314,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
313314	var  snapshot  =  evm .StateDB .Snapshot ()
314315
315316	// Invoke tracer hooks that signal entering/exiting a call frame 
316- 	if  evm .Config .Debug  {
317+ 	if  evm .Config .Tracer   !=   nil  {
317318		// NOTE: caller must, at all times be a contract. It should never happen 
318319		// that caller is something other than a Contract. 
319320		parent  :=  caller .(* Contract )
@@ -367,7 +368,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
367368	evm .StateDB .AddBalance (addr , big0 )
368369
369370	// Invoke tracer hooks that signal entering/exiting a call frame 
370- 	if  evm .Config .Debug  {
371+ 	if  evm .Config .Tracer   !=   nil  {
371372		evm .Config .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
372373		defer  func (startGas  uint64 ) {
373374			evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -450,7 +451,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
450451	contract  :=  NewContract (caller , AccountRef (address ), value , gas )
451452	contract .SetCodeOptionalHash (& address , codeAndHash )
452453
453- 	if  evm .Config .Debug  {
454+ 	if  evm .Config .Tracer   !=   nil  {
454455		if  evm .depth  ==  0  {
455456			evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
456457		} else  {
@@ -493,7 +494,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
493494		}
494495	}
495496
496- 	if  evm .Config .Debug  {
497+ 	if  evm .Config .Tracer   !=   nil  {
497498		if  evm .depth  ==  0  {
498499			evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , err )
499500		} else  {
0 commit comments