Commit 37dbb0f6 authored by Sebastian Stammler's avatar Sebastian Stammler

op-node: Fix maxDataSize calculation in ChannelOut.OutputFrame

Bedrock frames have a fixed overhead of 23 bytes.

Also removed the extra byte that was reserved for the version because
the calling sites of OutputFrame() already subtract this byte from their
maxSize arguments. This makes sense because the calling sites are
responsible for handling the correct overall tx data size.
parent e92bc23c
...@@ -133,9 +133,8 @@ func (co *ChannelOut) OutputFrame(w *bytes.Buffer, maxSize uint64) error { ...@@ -133,9 +133,8 @@ func (co *ChannelOut) OutputFrame(w *bytes.Buffer, maxSize uint64) error {
// Copy data from the local buffer into the frame data buffer // Copy data from the local buffer into the frame data buffer
// Don't go past the maxSize with the fixed frame overhead. // Don't go past the maxSize with the fixed frame overhead.
// Fixed overhead: 32 + 8 + 2 + 4 + 1 = 47 bytes. // Fixed overhead: 16 + 2 + 4 + 1 = 23 bytes.
// Add one extra byte for the version byte (for the entire L1 tx though) maxDataSize := maxSize - 23
maxDataSize := maxSize - 47 - 1
if maxDataSize > uint64(co.buf.Len()) { if maxDataSize > uint64(co.buf.Len()) {
maxDataSize = uint64(co.buf.Len()) maxDataSize = uint64(co.buf.Len())
// If we are closed & will not spill past the current frame // If we are closed & will not spill past the current frame
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment