Skip to content

Commit

Permalink
handle case where a new miniblock contains a snapshot (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikolsson authored Aug 8, 2024
1 parent d7de045 commit 060f9e7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/sdk/src/syncedStream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ export class SyncedStream extends Stream {
.map((e) => e.remoteEvent)
.filter(isDefined)

const lastSnapshotMiniblockNum =
miniblock.header.snapshot !== undefined
? miniblock.header.miniblockNum
: miniblock.header.prevSnapshotMiniblockNum

const cachedSyncedStream = new PersistedSyncedStream({
syncCookie: syncCookie,
lastSnapshotMiniblockNum: miniblock.header.prevSnapshotMiniblockNum,
lastSnapshotMiniblockNum: lastSnapshotMiniblockNum,
minipoolEvents: minipoolEvents,
lastMiniblockNum: miniblock.header.miniblockNum,
})
Expand Down

0 comments on commit 060f9e7

Please sign in to comment.