From 6d32cb2258157579bf4c373a22106a92614de2ba Mon Sep 17 00:00:00 2001 From: Mihajlo Pavlovic Date: Wed, 18 Dec 2024 14:04:05 +0100 Subject: [PATCH] Remove archive node and don't sync latest but latest - 2 --- .../blockchain-event-listener-command.js | 2 +- .../implementation/ot-ethers/ot-ethers.js | 19 +------------------ 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/commands/blockchain-event-listener/blockchain-event-listener-command.js b/src/commands/blockchain-event-listener/blockchain-event-listener-command.js index bbb8670d4..4c09d951d 100644 --- a/src/commands/blockchain-event-listener/blockchain-event-listener-command.js +++ b/src/commands/blockchain-event-listener/blockchain-event-listener-command.js @@ -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 }, diff --git a/src/modules/blockchain-events/implementation/ot-ethers/ot-ethers.js b/src/modules/blockchain-events/implementation/ot-ethers/ot-ethers.js index acf9c4f87..afd87ef4f 100644 --- a/src/modules/blockchain-events/implementation/ot-ethers/ot-ethers.js +++ b/src/modules/blockchain-events/implementation/ot-ethers/ot-ethers.js @@ -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}`,