Skip to content

Commit

Permalink
chore: rename latestblocknum to latestBlockNum
Browse files Browse the repository at this point in the history
  • Loading branch information
murongg committed Dec 12, 2024
1 parent 0e1b29f commit a2e45f4
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/reku/src/event/crosschecker/autochecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ export class AutoCrossChecker extends BaseCrossChecker {

this.cache = new CrossCheckerCacheManager(options?.store, { keyPrefix: options?.storeKeyPrefix, ttl: options?.storeTtl })

let latestblocknum = await timeoutWithRetry(() => this.provider.provider?.getBlockNumber(), 15 * 1000, 3)
let latestBlockNum = await timeoutWithRetry(() => this.provider.provider?.getBlockNumber(), 15 * 1000, 3)

// resume checkpoint priority: options.fromBlock > cache > latestblocknum + 1
const defaultInitCheckpoint = await this.cache.getCheckpoint() ?? (latestblocknum)
// resume checkpoint priority: options.fromBlock > cache > latestBlockNum + 1
const defaultInitCheckpoint = await this.cache.getCheckpoint() ?? (latestBlockNum)

const {
fromBlock = defaultInitCheckpoint,
Expand All @@ -87,10 +87,10 @@ export class AutoCrossChecker extends BaseCrossChecker {
}

const waitNextCrosscheck = async (): Promise<boolean> => {
latestblocknum = await timeoutWithRetry(() => this.provider.provider?.getBlockNumber(), 15 * 1000, 3)
if (ccrOptions.toBlock + delayBlockFromLatest > latestblocknum) {
latestBlockNum = await timeoutWithRetry(() => this.provider.provider?.getBlockNumber(), 15 * 1000, 3)
if (ccrOptions.toBlock + delayBlockFromLatest > latestBlockNum) {
// sleep until the toBlock
// await sleep((ccrOptions.toBlock + delayBlockFromLatest - latestblocknum) * blockInterval)
// await sleep((ccrOptions.toBlock + delayBlockFromLatest - latestBlockNum) * blockInterval)
return false
}
return true
Expand Down Expand Up @@ -130,7 +130,7 @@ export class AutoCrossChecker extends BaseCrossChecker {
await updateCCROptions(ccrOptions)
}
else {
debug('Because the latest block %d is too old, skip this cross check', latestblocknum)
debug('Because the latest block %d is too old, skip this cross check', latestBlockNum)
}
return endingCondition()
}, pollingInterval)
Expand Down

0 comments on commit a2e45f4

Please sign in to comment.