Skip to content

Commit

Permalink
fix(batcher): include checksum in zlib-compressed channel encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbenyun committed Nov 21, 2024
1 parent a820693 commit b3c6d6f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions op-node/rollup/derive/span_channel_out.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,18 @@ func (co *SpanChannelOut) Close() error {
return ErrChannelOutAlreadyClosed
}
co.closed = true
if err := co.Flush(); err != nil {
if err := co.compress.Close(); err != nil {
return err
}
return co.compress.Close()
if co.ReadyBytes() == 0 && co.compress.Len() > 0 {
_, err := io.Copy(co.reader, co.compress)
if err != nil {
// Must reset reader to avoid partial output
co.reader.Reset()
return fmt.Errorf("failed to flush compressed data to reader: %w", err)
}
}
return nil
}

// OutputFrame writes a frame to w with a given max size and returns the frame
Expand Down

0 comments on commit b3c6d6f

Please sign in to comment.