| 237 | } |
| 238 | |
| 239 | updateBlockFetching(): void { |
| 240 | const onlyEventHandlers = isOnlyEventHandlers(this.project); |
| 241 | const skipTransactions = |
| 242 | this.nodeConfig.skipTransactions && onlyEventHandlers; |
| 243 | |
| 244 | if (this.nodeConfig.skipTransactions) { |
| 245 | if (onlyEventHandlers) { |
| 246 | logger.info( |
| 247 | 'skipTransactions is enabled, only events and block headers will be fetched.', |
| 248 | ); |
| 249 | } else { |
| 250 | logger.info( |
| 251 | `skipTransactions is disabled, the project contains handlers that aren't event handlers.`, |
| 252 | ); |
| 253 | } |
| 254 | } else { |
| 255 | if (onlyEventHandlers) { |
| 256 | logger.warn( |
| 257 | 'skipTransactions is disabled, the project contains only event handlers, it could be enabled to improve indexing performance.', |
| 258 | ); |
| 259 | } else { |
| 260 | logger.info(`skipTransactions is disabled.`); |
| 261 | } |
| 262 | } |
| 263 | |
| 264 | const fetchFunc = skipTransactions |
| 265 | ? SubstrateUtil.fetchBlocksBatchesLight |
| 266 | : SubstrateUtil.fetchBlocksBatches; |
| 267 | |
| 268 | if (this.nodeConfig?.profiler) { |
| 269 | this._fetchBlocksFunction = profilerWrap( |
| 270 | fetchFunc, |
| 271 | 'SubstrateUtil', |
| 272 | 'fetchBlocksBatches', |
| 273 | ); |
| 274 | } else { |
| 275 | this._fetchBlocksFunction = fetchFunc; |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | get api(): ApiPromise { |
| 280 | return this.unsafeApi; |