Skip to content

Commit

Permalink
do sanity check first (ethereum-optimism#9689)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu authored Feb 29, 2024
1 parent 22ebfb8 commit 25b01cb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions op-node/rollup/derive/channel_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ func (co *SingularChannelOut) OutputFrame(w *bytes.Buffer, maxSize uint64) (uint

// BlockToSingularBatch transforms a block into a batch object that can easily be RLP encoded.
func BlockToSingularBatch(rollupCfg *rollup.Config, block *types.Block) (*SingularBatch, *L1BlockInfo, error) {
if len(block.Transactions()) == 0 {
return nil, nil, fmt.Errorf("block %v has no transactions", block.Hash())
}

opaqueTxs := make([]hexutil.Bytes, 0, len(block.Transactions()))
for i, tx := range block.Transactions() {
if tx.Type() == types.DepositTxType {
Expand All @@ -235,9 +239,7 @@ func BlockToSingularBatch(rollupCfg *rollup.Config, block *types.Block) (*Singul
}
opaqueTxs = append(opaqueTxs, otx)
}
if len(block.Transactions()) == 0 {
return nil, nil, fmt.Errorf("block %v has no transactions", block.Hash())
}

l1InfoTx := block.Transactions()[0]
if l1InfoTx.Type() != types.DepositTxType {
return nil, nil, ErrNotDepositTx
Expand Down

0 comments on commit 25b01cb

Please sign in to comment.