forked from cerc-io/plugeth
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994)
This commit is contained in:
+1
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user