Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logger?: LogTypes.ILogger,
) {
this.eth = eth;
this.firstSignificantBlockNumber = firstSignificantBlockNumber;
this.getLastBlockNumberMinDelay = getLastBlockNumberMinDelay;
this.logger = logger || new Utils.SimpleLogger();
// Get retry parameter values from config
this.retryDelay = retryDelay;
this.maxRetries = maxRetries;
// Setup the throttled and retriable getLastBlockNumber function
this.getLastBlockNumber = Utils.cachedThrottle(
() =>
Utils.retry(
() => {
this.logger.debug(`Getting last block number`, ['ethereum', 'ethereum-blocks']);
return this.eth.getBlockNumber();
},
{
maxRetries: this.maxRetries,
retryDelay: this.retryDelay,
},
)(),
this.getLastBlockNumberMinDelay,
);
}