diff --git a/src/services/blocks/BlocksService.spec.ts b/src/services/blocks/BlocksService.spec.ts index 2d4f414c8..90a05cfbb 100644 --- a/src/services/blocks/BlocksService.spec.ts +++ b/src/services/blocks/BlocksService.spec.ts @@ -149,7 +149,7 @@ describe('BlocksService', () => { }); it('throws when an extrinsic is undefined', async () => { - // Create a block with undefined as the first extrinisic and the last extrinsic removed + // Create a block with undefined as the first extrinsic and the last extrinsic removed const mockBlock789629BadExt = polkadotRegistry.createType('Block', block789629); mockBlock789629BadExt.extrinsics.pop(); @@ -377,7 +377,7 @@ describe('BlocksService', () => { paraId: undefined, }; - it('Returns the correct extrinisics object for block 789629', async () => { + it('Returns the correct extrinsics object for block 789629', async () => { const block = await blocksService.fetchBlock(blockHash789629, mockHistoricApi, options); /** diff --git a/src/services/blocks/BlocksService.ts b/src/services/blocks/BlocksService.ts index b37258365..df4c06481 100644 --- a/src/services/blocks/BlocksService.ts +++ b/src/services/blocks/BlocksService.ts @@ -438,7 +438,7 @@ export class BlocksService extends AbstractService { /** * Retrieve the blockHash for the previous block to the one getting queried. - * If the block is the geneisis hash it will return the same blockHash. + * If the block is the genesis hash it will return the same blockHash. * * @param blockNumber The blockId being queried */ @@ -590,7 +590,7 @@ export class BlocksService extends AbstractService { const extrinsicIdx = phase.asApplyExtrinsic.toNumber(); const extrinsic = extrinsics[extrinsicIdx]; - if (!extrinsic) { + if (!extrinsic && event.section != 'multiBlockMigrations') { throw new Error(`Missing extrinsic ${extrinsicIdx} in block ${hash.toString()}`); } @@ -610,7 +610,9 @@ export class BlocksService extends AbstractService { } } - extrinsic.events.push(sanitizedEvent); + if (extrinsic) { + extrinsic.events.push(sanitizedEvent); + } } else if (phase.isFinalization) { onFinalize.events.push(sanitizedEvent); } else if (phase.isInitialization) { @@ -789,7 +791,7 @@ export class BlocksService extends AbstractService { } /** - * Fetch a block with raw extrinics values. + * Fetch a block with raw extrinsics values. * * @param hash `BlockHash` of the block to fetch. */