Skip to content

Commit

Permalink
Fix TestStreamClientGetLatestL2Block
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal committed Sep 20, 2024
1 parent 4987b5c commit 8631639
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions zk/datastream/client/stream_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ func (c *StreamClient) GetLatestL2Block() (l2Block *types.FullL2Block, err error
}

latestEntryNum := h.TotalEntries - 1
var ok bool

for l2Block == nil && latestEntryNum > 0 {
if err := c.sendEntryCmdWrapper(latestEntryNum); err != nil {
return nil, err
}

parsedEntry, err := ReadParsedProto(c)
entry, err := c.NextFileEntry()
if err != nil {
return nil, err
}

l2Block, ok = parsedEntry.(*types.FullL2Block)
if ok {
return l2Block, nil
if entry.EntryType == types.EntryTypeL2Block {
if l2Block, err = types.UnmarshalL2Block(entry.Data); err != nil {
return nil, err
}
}

latestEntryNum--
Expand Down

0 comments on commit 8631639

Please sign in to comment.