Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ctxc/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ const (
defaultTracechainMemLimit = common.StorageSize(500 * 1024 * 1024)
)

var errTxNotFound = errors.New("transaction not found")

// StateReleaseFunc is used to deallocate resources held by constructing a
// historical state for tracing purposes.
type StateReleaseFunc func()
Expand Down Expand Up @@ -807,10 +809,15 @@ func containsTx(block *types.Block, hash common.Hash) bool {
// TraceTransaction returns the structured logs created during the execution of CVM
// and returns them as a JSON object.
func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) {
_, blockHash, blockNumber, index, err := api.backend.GetTransaction(ctx, hash)
tx, blockHash, blockNumber, index, err := api.backend.GetTransaction(ctx, hash)
if err != nil {
return nil, err
}

// Only mined txes are supported
if tx == nil {
return nil, errTxNotFound
}
// It shouldn't happen in practice.
if blockNumber == 0 {
return nil, errors.New("genesis is not traceable")
Expand Down