Skip to content

Commit

Permalink
Merge pull request ledgerwatch#21 from testinprod-io/fix-ots-api
Browse files Browse the repository at this point in the history
Fix ots API - Phase 2 : Comments
  • Loading branch information
ImTei committed Mar 30, 2023
2 parents 8ff9ae5 + c812de9 commit c5b1f9c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/rpcdaemon/commands/otterscan_search_trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,21 @@ func (api *OtterscanAPIImpl) searchTraceBlock(ctx, traceCtx context.Context, tra
}
defer newdbtx.Rollback()

// found will be false when CallTraceSet info and CallFromIndex/CallToIndex table info mismatch
// searchTraceBlock goroutine will sequentially search every block written in CallTraceSet
// when mismatch, causing cpu hike. To avoid this, when inconsistency found, early terminate.
found, result, err := api.traceBlock(newdbtx, ctx, bNum, addr, chainConfig)
if !found {
// tx execution result and callFromToProvider() result mismatch
err = fmt.Errorf("search trace failure: inconsistency at block %d", bNum)
select {
case <-traceCtx.Done():
return
return
case errCh <- err:
default:
}
traceCtxCancel()
return
return
}
if err != nil {
log.Error("Search trace error", "err", err)
Expand Down

0 comments on commit c5b1f9c

Please sign in to comment.