diff --git a/eth/tracers/firehose.go b/eth/tracers/firehose.go index 293ba4d08a..922f54234d 100644 --- a/eth/tracers/firehose.go +++ b/eth/tracers/firehose.go @@ -1908,8 +1908,11 @@ func (f *Firehose) panicInvalidState(msg string, callerSkip int) string { // printBlockToFirehose is a helper function to print a block to Firehose protocl format. func (f *Firehose) printBlockToFirehose(block *pbeth.Block, finalityStatus *FinalityStatus) { - channelSize := int(math.Ceil(20000 * 8 / 6)) - buf := bytes.NewBuffer(make([]byte, 0, channelSize)) + + headerSize := 225 // FIRE BLOCK:11 + base64Size := math.Ceil(float64(proto.Size(block)) * 8 / 6) + bufferSize := headerSize + int(base64Size) + buf := bytes.NewBuffer(make([]byte, 0, bufferSize)) marshalled, err := proto.Marshal(block)