Skip to content

Commit

Permalink
fix: always clean header
Browse files Browse the repository at this point in the history
  • Loading branch information
eddort committed Oct 6, 2024
1 parent 235fd65 commit b3fc128
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/contracts/deposits-registry/store/store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,25 @@ export class DepositsRegistryStoreService {
lastValidEventIndex = event.depositCount;
}

const lastValidEvent = currentCache.data[lastValidEventIndex];

if (!isCacheConsistent) {
const lastValidEvent = currentCache.data[lastValidEventIndex];
const nextEvent = currentCache.data[lastValidEventIndex + 1];

this.logger.warn('Deposit cache is inconsistent', {
lastValidEvent,
nextEvent,
});
}

const headers = this.formDepositEventHeaderForDeletion(
lastValidEvent?.blockNumber,
);
const headers = this.formDepositEventHeaderForDeletion(
lastValidEvent?.blockNumber,
);

await this.deleteDepositsGreaterThanOrEqualNBatch(
lastValidEventIndex + 1,
headers,
);
}
await this.deleteDepositsGreaterThanOrEqualNBatch(
lastValidEventIndex + 1,
headers,
);
}

/**
Expand Down

0 comments on commit b3fc128

Please sign in to comment.