MCPcopy Create free account
hub / github.com/CPChain/chain / TraceTransaction

Method TraceTransaction

protocols/cpc/api_tracer.go:571–587  ·  view source on GitHub ↗

TraceTransaction returns the structured logs created during the execution of EVM and returns them as a JSON object.

(ctx context.Context, hash common.Hash, config *TraceConfig)

Source from the content-addressed store, hash-verified

569// TraceTransaction returns the structured logs created during the execution of EVM
570// and returns them as a JSON object.
571func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) {
572 // Retrieve the transaction and assemble its EVM context
573 tx, blockHash, _, index := rawdb.ReadTransaction(api.cpc.ChainDb(), hash)
574 if tx == nil {
575 return nil, fmt.Errorf("transaction %x not found", hash)
576 }
577 reexec := defaultTraceReexec
578 if config != nil && config.Reexec != nil {
579 reexec = *config.Reexec
580 }
581 msg, vmctx, statedb, err := api.computeTxEnv(blockHash, int(index), reexec)
582 if err != nil {
583 return nil, err
584 }
585 // Trace the transaction and return
586 return api.traceTx(ctx, msg, vmctx, statedb, config)
587}
588
589// traceTx configures a new tracer according to the provided configuration, and
590// executes the given message in the provided environment. The return value will

Callers

nothing calls this directly

Calls 3

computeTxEnvMethod · 0.95
traceTxMethod · 0.95
ChainDbMethod · 0.65

Tested by

no test coverage detected