diff --git a/internal/interfaces/block_producer_config.ts b/internal/interfaces/block_producer_config.ts index a38c299..34c6f47 100644 --- a/internal/interfaces/block_producer_config.ts +++ b/internal/interfaces/block_producer_config.ts @@ -4,6 +4,7 @@ export interface IBlockProducerConfig extends IProducerConfig { startBlock?: number, rpcWsEndpoints?: string[], mongoUrl?: string, + dbCollection?: string, maxReOrgDepth?: number, maxRetries?: number, blockPollingTimeout?: number, diff --git a/public/block_producers/block_polling_producer.ts b/public/block_producers/block_polling_producer.ts index 1779cd5..9370938 100644 --- a/public/block_producers/block_polling_producer.ts +++ b/public/block_producers/block_polling_producer.ts @@ -25,6 +25,7 @@ export class BlockPollerProducer extends BlockProducer { const endpoint = config.rpcWsEndpoints?.[0] || ""; const startBlock = config.startBlock || 0; const mongoUrl = config.mongoUrl || "mongodb://localhost:27017/chain-indexer"; + const dbCollection = config.dbCollection || "producedblocks"; const blockPollingTimeout = config.blockPollingTimeout || 2000; const maxRetries = config.maxRetries || 0; const maxReOrgDepth = config.maxReOrgDepth || 0; @@ -32,6 +33,7 @@ export class BlockPollerProducer extends BlockProducer { delete config.rpcWsEndpoints; delete config.startBlock; delete config.mongoUrl; + delete config.dbCollection; delete config.maxReOrgDepth; delete config.maxRetries; delete config.blockPollingTimeout; @@ -60,7 +62,7 @@ export class BlockPollerProducer extends BlockProducer { database.model>( "ProducedBlocks", ProducedBlocksModel, - "producedblocks" + dbCollection ), startBlock, maxReOrgDepth diff --git a/public/block_producers/block_producer.ts b/public/block_producers/block_producer.ts index 7ba9a5e..7d4f899 100644 --- a/public/block_producers/block_producer.ts +++ b/public/block_producers/block_producer.ts @@ -28,6 +28,7 @@ export class BlockProducer extends InternalBlockProducer { const endpoints = config.rpcWsEndpoints || []; const startBlock = config.startBlock || 0; const mongoUrl = config.mongoUrl || "mongodb://localhost:27017/chain-indexer"; + const dbCollection = config.dbCollection || "producedblocks"; const maxReOrgDepth = config.maxReOrgDepth || 0; const maxRetries = config.maxRetries || 0; const blockSubscriptionTimeout = config.blockSubscriptionTimeout; @@ -36,6 +37,7 @@ export class BlockProducer extends InternalBlockProducer { delete config.rpcWsEndpoints; delete config.startBlock; delete config.mongoUrl; + delete config.dbCollection; delete config.maxReOrgDepth; delete config.maxRetries; delete config.blockSubscriptionTimeout; @@ -75,7 +77,7 @@ export class BlockProducer extends InternalBlockProducer { database.model>( "ProducedBlocks", ProducedBlocksModel, - "producedblocks" + dbCollection ), startBlock, maxReOrgDepth diff --git a/public/block_producers/erigon_block_producer.ts b/public/block_producers/erigon_block_producer.ts index bbb42cc..e961801 100644 --- a/public/block_producers/erigon_block_producer.ts +++ b/public/block_producers/erigon_block_producer.ts @@ -26,6 +26,7 @@ export class ErigonBlockProducer extends BlockProducer { const endpoints = config.rpcWsEndpoints || []; const startBlock = config.startBlock || 0; const mongoUrl = config.mongoUrl || "mongodb://localhost:27017/chain-indexer"; + const dbCollection = config.dbCollection || "producedblocks"; const maxReOrgDepth = config.maxReOrgDepth || 0; const maxRetries = config.maxRetries || 0; const blockSubscriptionTimeout = config.blockSubscriptionTimeout; @@ -34,6 +35,7 @@ export class ErigonBlockProducer extends BlockProducer { delete config.rpcWsEndpoints; delete config.startBlock; delete config.mongoUrl; + delete config.dbCollection; delete config.maxReOrgDepth; delete config.maxRetries; delete config.blockSubscriptionTimeout; @@ -73,7 +75,7 @@ export class ErigonBlockProducer extends BlockProducer { database.model>( "ProducedBlocks", ProducedBlocksModel, - "producedblocks" + dbCollection ), startBlock, maxReOrgDepth diff --git a/public/block_producers/quicknode_block_producer.ts b/public/block_producers/quicknode_block_producer.ts index 47ed92b..cabaca6 100644 --- a/public/block_producers/quicknode_block_producer.ts +++ b/public/block_producers/quicknode_block_producer.ts @@ -27,6 +27,7 @@ export class QuickNodeBlockProducer extends BlockProducer { const endpoints = config.rpcWsEndpoints || []; const startBlock = config.startBlock || 0; const mongoUrl = config.mongoUrl || "mongodb://localhost:27017/chain-indexer"; + const dbCollection = config.dbCollection || "producedblocks"; const maxReOrgDepth = config.maxReOrgDepth || 0; const maxRetries = config.maxRetries || 0; const blockSubscriptionTimeout = config.blockSubscriptionTimeout; @@ -38,6 +39,7 @@ export class QuickNodeBlockProducer extends BlockProducer { delete config.rpcWsEndpoints; delete config.startBlock; delete config.mongoUrl; + delete config.dbCollection; delete config.maxReOrgDepth; delete config.maxRetries; delete config.blockDelay; @@ -85,7 +87,7 @@ export class QuickNodeBlockProducer extends BlockProducer { database.model>( "ProducedBlocks", ProducedBlocksModel, - "producedblocks" + dbCollection ), startBlock, maxReOrgDepth