Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kyscott18 committed Oct 3, 2024
1 parent e3d6e68 commit 23e3fbc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/core/src/sync/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -997,8 +997,15 @@ export async function* localHistoricalSyncGenerator({
// Cursor to track progress.
let fromBlock = hexToNumber(syncProgress.start.number);

// Handle a cache hit by fast forwarding and potentially exiting
if (syncProgress.current !== undefined) {
/**
* Handle a cache hit by fast forwarding and potentially exiting
*/
if (
syncProgress.current !== undefined &&
(syncProgress.cached === undefined ||
hexToNumber(syncProgress.current.number) >
hexToNumber(syncProgress.cached.number))
) {
fromBlock = hexToNumber(syncProgress.current.number) + 1;
} else if (syncProgress.cached !== undefined) {
// `getEvents` can make progress without calling `sync`, so immediately "yield"
Expand Down

0 comments on commit 23e3fbc

Please sign in to comment.