diff --git a/packages/node-core/CHANGELOG.md b/packages/node-core/CHANGELOG.md index 43e044076c..902c1ce350 100644 --- a/packages/node-core/CHANGELOG.md +++ b/packages/node-core/CHANGELOG.md @@ -6,10 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed +- Dictionary validation error causing application exit (#2101) - Auto queue flush getting the queue into a bad state (#2103) - - -### Fixed - Fix getCache could not been cleared after reindex, and could have been re-used and lead to error, such as syncPoi ## [6.0.2] - 2023-10-12 diff --git a/packages/node-core/src/indexer/dictionary.service.ts b/packages/node-core/src/indexer/dictionary.service.ts index 68a8930adc..fbd08edeaa 100644 --- a/packages/node-core/src/indexer/dictionary.service.ts +++ b/packages/node-core/src/indexer/dictionary.service.ts @@ -427,22 +427,27 @@ export class DictionaryService { private dictionaryValidation(metaData?: MetaData, startBlockHeight?: number): boolean { const validate = (): boolean => { - if (!metaData) { - return false; - } - // Some dictionaries rely on chain others rely on genesisHash - if (!this.validateChainMeta(metaData)) { - logger.error( - 'The dictionary that you have specified does not match the chain you are indexing, it will be ignored. Please update your project manifest to reference the correct dictionary' - ); - return false; - } + try { + if (!metaData) { + return false; + } + // Some dictionaries rely on chain others rely on genesisHash + if (!this.validateChainMeta(metaData)) { + logger.error( + 'The dictionary that you have specified does not match the chain you are indexing, it will be ignored. Please update your project manifest to reference the correct dictionary' + ); + return false; + } - if (startBlockHeight !== undefined && metaData.lastProcessedHeight < startBlockHeight) { - logger.warn(`Dictionary indexed block is behind current indexing block height`); + if (startBlockHeight !== undefined && metaData.lastProcessedHeight < startBlockHeight) { + logger.warn(`Dictionary indexed block is behind current indexing block height`); + return false; + } + return true; + } catch (e: any) { + logger.error(e, 'Unable to validate dictionary metadata'); return false; } - return true; }; const valid = validate();