Simplifying a TypeScript Blockchain Validation Snippet

can the below snippet be simplified ?
looked around in the docs and API spec, found nothing that could minimize the verbosity

validateChain: (state: BlockchainState) =>
    Effect.gen(function* () {
      const blocks = Chunk.toReadonlyArray(state.chain);

      for (let i = 1; i < blocks.length; i++) {
        const current = blocks[i];
        const previous = blocks[i - 1];
        const { hash, ...blockWithoutHash } = current;
        const recalculatedHash = Block.computeHash(blockWithoutHash);

        if (hash !== recalculatedHash)
          return yield* Effect.fail(`Block #${i} hash mismatch`);

        if (current.previousHash !== previous.hash)
          return yield* Effect.fail(`Block #${i} chain link broken`);
      }
    }),
Was this page helpful?