diff --git a/packages/reed-solomon/src/index.js b/packages/reed-solomon/src/index.js index d4dd77d3..fa4e7ad2 100644 --- a/packages/reed-solomon/src/index.js +++ b/packages/reed-solomon/src/index.js @@ -178,9 +178,6 @@ export class ReedSolomon { }; } - /** - * @param {Array[{index, segChecksum, encodeDataHash}]} encodeShards - */ getChecksumsByEncodeShards(encodeShards) { let hashList = []; let segChecksumList = []; diff --git a/packages/reed-solomon/src/web.adapter.js b/packages/reed-solomon/src/web.adapter.js index e400befc..3088736c 100644 --- a/packages/reed-solomon/src/web.adapter.js +++ b/packages/reed-solomon/src/web.adapter.js @@ -12,6 +12,9 @@ export class WebAdapterReedSolomon extends ReedSolomon { } async encodeInWorker(sourceData) { + if (!this.workerNum || !this.workers) + throw new Error('`initWorkers` must be executed first to ensure the number of workers'); + // RES is `encodeShards` Array let RES = []; const chunkList = splitPrice(sourceData, this.segmentSize);