@@ -23,6 +23,7 @@ import (
23
23
"errors"
24
24
"fmt"
25
25
"io/ioutil"
26
+ "math/big"
26
27
"os"
27
28
"runtime"
28
29
"sync"
@@ -910,10 +911,21 @@ func (api *API) TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHa
910
911
Reexec : config .Reexec ,
911
912
}
912
913
}
913
- res , err := api .traceTx (ctx , msg , new (txTraceContext ), vmctx , statedb , privateStateDb , privateStateRepo , noTracerConfig ) // test private with no config
914
- if exeRes , ok := res .(* ethapi.ExecutionResult ); ok && err == nil && len (exeRes .StructLogs ) > 0 { // check there is a result
914
+
915
+ // create a mock private context
916
+ emptyTx := types .NewTransaction (
917
+ 0 ,
918
+ common.Address {},
919
+ big .NewInt (0 ), 0 , big .NewInt (0 ),
920
+ nil ,
921
+ )
922
+ emptyTx .SetPrivate ()
923
+ traceContext := & txTraceContext {tx : emptyTx }
924
+
925
+ res , err := api .traceTx (ctx , msg , traceContext , vmctx , statedb , privateStateDb , privateStateRepo , noTracerConfig ) // test private with no config
926
+ if exeRes , ok := res .(* ethapi.ExecutionResult ); ok && err == nil && len (exeRes .StructLogs ) > 0 { // check there is a result
915
927
if config != nil && config .Tracer != nil { // re-run the private call with the custom JS tracer
916
- return api .traceTx (ctx , msg , new ( txTraceContext ) , vmctx , statedb , privateStateDb , privateStateRepo , traceConfig ) // re-run with trace
928
+ return api .traceTx (ctx , msg , traceContext , vmctx , statedb , privateStateDb , privateStateRepo , traceConfig ) // re-run with trace
917
929
}
918
930
return res , err // return private result with no tracer
919
931
} else if err == nil && ! ok {
0 commit comments