Remove panic recover

This commit is contained in:
yzang2019 2025-09-03 10:12:51 -07:00
parent 23651e4329
commit 1358a5e60c

View file

@ -874,12 +874,6 @@ func containsTx(block *types.Block, hash common.Hash) bool {
// TraceTransaction returns the structured logs created during the execution of EVM // TraceTransaction returns the structured logs created during the execution of EVM
// and returns them as a JSON object. // and returns them as a JSON object.
func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (value interface{}, returnErr error) { func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (value interface{}, returnErr error) {
defer func() {
if r := recover(); r != nil {
value = nil
returnErr = fmt.Errorf("panic occurred: %v, could not trace tx: %s", r, hash.Hex())
}
}()
tx, blockHash, blockNumber, index, err := api.backend.GetTransaction(ctx, hash) tx, blockHash, blockNumber, index, err := api.backend.GetTransaction(ctx, hash)
if err != nil { if err != nil {
return nil, err return nil, err
@ -1011,12 +1005,6 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
timeout = defaultTraceTimeout timeout = defaultTraceTimeout
usedGas uint64 usedGas uint64
) )
defer func() {
if r := recover(); r != nil {
value = nil
returnErr = fmt.Errorf("panic occurred: %v, could not trace tx: %s", r, tx.Hash())
}
}()
if config == nil { if config == nil {
config = &TraceConfig{} config = &TraceConfig{}
} }