all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994)

This commit is contained in:
Felix Lange
2023-08-24 11:47:42 +03:00
committed by GitHub
parent 60ec41ce73
commit 9b46986edc
9 changed files with 13 additions and 17 deletions
+1 -2
View File
@@ -18,7 +18,6 @@ package tracers
import (
"bufio"
"bytes"
"context"
"encoding/json"
"errors"
@@ -453,7 +452,7 @@ func (api *API) TraceBlockByHash(ctx context.Context, hash common.Hash, config *
// and returns them as a JSON object.
func (api *API) TraceBlock(ctx context.Context, blob hexutil.Bytes, config *TraceConfig) ([]*txTraceResult, error) {
block := new(types.Block)
if err := rlp.Decode(bytes.NewReader(blob), block); err != nil {
if err := rlp.DecodeBytes(blob, block); err != nil {
return nil, fmt.Errorf("could not decode block: %v", err)
}
return api.traceBlock(ctx, block, config)