|
1 | 1 | import { inject } from "tsyringe";
|
2 |
| -import { log } from "@proto-kit/common"; |
| 2 | +import { injectOptional, log } from "@proto-kit/common"; |
3 | 3 | import {
|
4 | 4 | MethodIdResolver,
|
5 | 5 | MethodParameterEncoder,
|
@@ -41,7 +41,8 @@ export class BlockProducerModule extends SequencerModule<BlockConfig> {
|
41 | 41 |
|
42 | 42 | public constructor(
|
43 | 43 | @inject("Mempool") private readonly mempool: Mempool,
|
44 |
| - private readonly messageService: IncomingMessagesService, |
| 44 | + @injectOptional("IncomingMessagesService") |
| 45 | + private readonly messageService: IncomingMessagesService | undefined, |
45 | 46 | @inject("UnprovenStateService")
|
46 | 47 | private readonly unprovenStateService: AsyncStateService,
|
47 | 48 | @inject("UnprovenMerkleStore")
|
@@ -171,6 +172,8 @@ export class BlockProducerModule extends SequencerModule<BlockConfig> {
|
171 | 172 | return undefined;
|
172 | 173 | }
|
173 | 174 |
|
| 175 | + // TODO Move to different service, to remove dependency on mempool and messagequeue |
| 176 | + // Idea: Create a service that aggregates a bunch of different sources |
174 | 177 | @trace("block.collect_inputs")
|
175 | 178 | private async collectProductionData(): Promise<{
|
176 | 179 | txs: PendingTransaction[];
|
@@ -199,7 +202,10 @@ export class BlockProducerModule extends SequencerModule<BlockConfig> {
|
199 | 202 | };
|
200 | 203 | }
|
201 | 204 |
|
202 |
| - const messages = await this.messageService.getPendingMessages(); |
| 205 | + let messages: PendingTransaction[] = []; |
| 206 | + if (this.messageService !== undefined) { |
| 207 | + messages = await this.messageService.getPendingMessages(); |
| 208 | + } |
203 | 209 |
|
204 | 210 | log.debug(
|
205 | 211 | `Block collected, ${txs.length} txs, ${messages.length} messages`
|
|
0 commit comments