@@ -182,11 +182,12 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
182
182
}
183
183
snapshot := evm .StateDB .Snapshot ()
184
184
p , isPrecompile := evm .precompile (addr )
185
+ debug := evm .Config .Tracer != nil
185
186
186
187
if ! evm .StateDB .Exist (addr ) {
187
188
if ! isPrecompile && evm .chainRules .IsEIP158 && value .Sign () == 0 {
188
189
// Calling a non existing account, don't do anything, but ping the tracer
189
- if evm . Config . Debug {
190
+ if debug {
190
191
if evm .depth == 0 {
191
192
evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
192
193
evm .Config .Tracer .CaptureEnd (ret , 0 , nil )
@@ -202,7 +203,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
202
203
evm .Context .Transfer (evm .StateDB , caller .Address (), addr , value )
203
204
204
205
// Capture the tracer start/end events in debug mode
205
- if evm . Config . Debug {
206
+ if debug {
206
207
if evm .depth == 0 {
207
208
evm .Config .Tracer .CaptureStart (evm , caller .Address (), addr , false , input , gas , value )
208
209
defer func (startGas uint64 ) { // Lazy evaluation of the parameters
@@ -272,7 +273,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
272
273
var snapshot = evm .StateDB .Snapshot ()
273
274
274
275
// Invoke tracer hooks that signal entering/exiting a call frame
275
- if evm .Config .Debug {
276
+ if evm .Config .Tracer != nil {
276
277
evm .Config .Tracer .CaptureEnter (CALLCODE , caller .Address (), addr , input , gas , value )
277
278
defer func (startGas uint64 ) {
278
279
evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -313,7 +314,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
313
314
var snapshot = evm .StateDB .Snapshot ()
314
315
315
316
// Invoke tracer hooks that signal entering/exiting a call frame
316
- if evm .Config .Debug {
317
+ if evm .Config .Tracer != nil {
317
318
// NOTE: caller must, at all times be a contract. It should never happen
318
319
// that caller is something other than a Contract.
319
320
parent := caller .(* Contract )
@@ -367,7 +368,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
367
368
evm .StateDB .AddBalance (addr , big0 )
368
369
369
370
// Invoke tracer hooks that signal entering/exiting a call frame
370
- if evm .Config .Debug {
371
+ if evm .Config .Tracer != nil {
371
372
evm .Config .Tracer .CaptureEnter (STATICCALL , caller .Address (), addr , input , gas , nil )
372
373
defer func (startGas uint64 ) {
373
374
evm .Config .Tracer .CaptureExit (ret , startGas - gas , err )
@@ -450,7 +451,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
450
451
contract := NewContract (caller , AccountRef (address ), value , gas )
451
452
contract .SetCodeOptionalHash (& address , codeAndHash )
452
453
453
- if evm .Config .Debug {
454
+ if evm .Config .Tracer != nil {
454
455
if evm .depth == 0 {
455
456
evm .Config .Tracer .CaptureStart (evm , caller .Address (), address , true , codeAndHash .code , gas , value )
456
457
} else {
@@ -493,7 +494,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
493
494
}
494
495
}
495
496
496
- if evm .Config .Debug {
497
+ if evm .Config .Tracer != nil {
497
498
if evm .depth == 0 {
498
499
evm .Config .Tracer .CaptureEnd (ret , gas - contract .Gas , err )
499
500
} else {
0 commit comments