Skip to content

Commit

Permalink
Merge pull request #3525 from OriginTrail/chore/dont-sync-latest-block
Browse files Browse the repository at this point in the history
Don't sync latest block
  • Loading branch information
Mihajlo-Pavlovic authored Dec 18, 2024
2 parents 8147705 + 6d32cb2 commit a9ca5e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class BlockchainEventListenerCommand extends Command {
}

async fetchAndHandleBlockchainEvents(blockchainId, repositoryTransaction) {
this.currentBlock = (await this.blockchainEventsService.getBlock(blockchainId)).number;
this.currentBlock = (await this.blockchainEventsService.getBlock(blockchainId)).number - 2;
const lastCheckedBlockRecord = await this.repositoryModuleManager.getLastCheckedBlock(
blockchainId,
{ transaction: repositoryTransaction },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,7 @@ class OtEthers extends BlockchainEventsService {

// eslint-disable-next-line no-await-in-loop
await provider.getNetwork();

let isArchiveNode = false;
try {
// eslint-disable-next-line no-await-in-loop
const block = await provider.getBlock(1);
if (block) {
isArchiveNode = true;
}
} catch (error) {
this.logger.warn(`RPC ${rpcEndpoint} is not an archive node.`);
}

if (isArchiveNode) {
validProviders.push(provider);
this.logger.info(`Connected to archive node: ${rpcEndpoint}`);
} else {
this.logger.warn(`Skipping non-archive node: ${rpcEndpoint}`);
}
validProviders.push(provider);
} catch (error) {
this.logger.error(
`Failed to initialize provider: ${rpcEndpoint}. Error: ${error.message}`,
Expand Down

0 comments on commit a9ca5e0

Please sign in to comment.