eth/catalyst: don't panic

This commit is contained in:
MariusVanDerWijden 2026-02-16 18:02:41 +01:00
parent 0c5ba499c1
commit ac3b634792

View file

@ -6,6 +6,7 @@ import (
"github.com/ethereum/go-ethereum/beacon/engine" "github.com/ethereum/go-ethereum/beacon/engine"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth" "github.com/ethereum/go-ethereum/eth"
"github.com/ethereum/go-ethereum/miner" "github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/node"
@ -40,13 +41,17 @@ func (api *TestingAPI) BuildBlockV1(parentHash common.Hash, payloadAttributes en
// If the transactions is nil, build a block with the current transactions from the txpool // If the transactions is nil, build a block with the current transactions from the txpool
// If the transactions is not nil and not empty, build a block with the transactions // If the transactions is not nil and not empty, build a block with the transactions
buildEmpty := transactions != nil && len(*transactions) == 0 buildEmpty := transactions != nil && len(*transactions) == 0
dec := make([][]byte, 0, len(*transactions)) var txs []*types.Transaction
for _, tx := range *transactions { if transactions != nil {
dec = append(dec, tx) dec := make([][]byte, 0, len(*transactions))
} for _, tx := range *transactions {
txs, err := engine.DecodeTransactions(dec) dec = append(dec, tx)
if err != nil { }
return nil, err var err error
txs, err = engine.DecodeTransactions(dec)
if err != nil {
return nil, err
}
} }
extra := make([]byte, 0) extra := make([]byte, 0)
if extraData != nil { if extraData != nil {