@dashevo/dash-spv 0.25.15 → 0.25.16-pr.1562.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"files":{".eslintignore":"5772aab4a649e8c99c5b74bd685792cd6a69f9ac",".eslintrc.json":"41aa1d3c1477f203b588dcb5c0015454edd94481",".gitignore":"095d365a56f423d4fab2345c95c137e7c6ea45c0",".mocharc.yml":"f6d924f143da5bc22530e55dcec6922aff69d8e1","LICENSE":"95bf3c7cb642fb61c1bbbb319fd3c83e47a5af96","README.md":"3659fd1bfb44b5e6916679ae586ccbff18683e59","config/config.js":"267c3536b5fe54c88080a56241c34d7393a54ac2","index.js":"4413accedb71ffb73ea7ce4ad45a2035c2ce92ca","lib/blockstore.js":"1ed82a8c1cfb4bc3aa96f0669a27c94d2e76b164","lib/consensus.js":"73201c7fec9c62f5f87dba7b2d0d54c08fa4fa6f","lib/errors/SPVError.js":"08b7af972c146bcdf29ffaa06eb90ca2c5660914","lib/merkleproofs.js":"dca09952c352109795af64f9490209a96e483e2f","lib/spvchain.js":"4ada79dda7b544debbfc023c1ce5ad058bb0c034","lib/test/.eslintrc":"4c2b11fe8177c0c2fd0667acb599fc44c4c9741a","lib/test/bootstrap.js":"e2b2b2b17a9bf0ebff7721d8cb1e5cb75efb0f0f","lib/utils.js":"c2119b88a67698053e783f09c038a04ae208f232","lib/x11.js":"d85e555bad579a8b3e2e92447331933ce9b0c4b1","package.json":"0bac84ef8cf78f3a73934c670766f9979612fafc","test/data/headers.js":"eb9cae85ee11027338fbf1f69e373d22388286d6","test/data/merkleproofs.js":"49ea4c29fb1f0cf6378ed7ee46b0a1db3bb555c1","test/data/rawHeaders.js":"03fed6ca2f8c2d1b63cfa13743431a2d551c7ad9","test/index.js":"4b67c838fadf0baac0207b13ddd99b0bc8d228c0","test/spvchain.js":"58a7716c91830e0a23bd27ab857cbba70b8bee93"},"deps":{}}
package/lib/spvchain.js CHANGED
@@ -342,31 +342,29 @@ const SpvChain = class {
342
342
  throw new SPVError(`Batch at invalid height arrived: ${batchHeadHeight}, expected > ${this.pendingStartBlockHeight}`);
343
343
  }
344
344
 
345
- const allValid = normalizedHeaders.reduce(
346
- (acc, header, index, array) => {
347
- const previousHeaders = normalizedHeaders.slice(0, index);
348
- if (index !== 0) {
349
- if (!SpvChain.isParentChild(header, array[index - 1])) {
350
- throw new SPVError(`SPV: Header ${header.hash} is not a child of ${array[index - 1].hash}`);
351
- }
352
-
353
- if (!this.isValid(header, previousHeaders)) {
354
- throw new SPVError(`SPV: Header ${header.hash} is invalid`);
355
- }
356
- return acc && true;
345
+ const allValid = normalizedHeaders.reduce((acc, header, index, array) => {
346
+ const previousHeaders = normalizedHeaders.slice(0, index);
347
+ if (index !== 0) {
348
+ if (!SpvChain.isParentChild(header, array[index - 1])) {
349
+ throw new SPVError(`SPV: Header ${header.hash} is not a child of ${array[index - 1].hash}`);
357
350
  }
358
- if (isOrphan) {
359
- if (!this.isValid(header, previousHeaders)) {
360
- throw new SPVError('Some headers are invalid');
361
- }
362
- return acc && true;
351
+
352
+ if (!this.isValid(header, previousHeaders)) {
353
+ throw new SPVError(`SPV: Header ${header.hash} is invalid`);
363
354
  }
364
- if (!this.isValid(header, this.getLongestChain())) {
355
+ return acc && true;
356
+ }
357
+ if (isOrphan) {
358
+ if (!this.isValid(header, previousHeaders)) {
365
359
  throw new SPVError('Some headers are invalid');
366
360
  }
367
361
  return acc && true;
368
- }, true,
369
- );
362
+ }
363
+ if (!this.isValid(header, this.getLongestChain())) {
364
+ throw new SPVError('Some headers are invalid');
365
+ }
366
+ return acc && true;
367
+ }, true);
370
368
  if (!allValid) {
371
369
  throw new SPVError('Some headers are invalid');
372
370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/dash-spv",
3
- "version": "0.25.15",
3
+ "version": "0.25.16-pr.1562.1",
4
4
  "description": "Repository containing SPV functions used by @dashevo",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,12 +20,12 @@
20
20
  "wasm-x11-hash": "~0.0.2"
21
21
  },
22
22
  "devDependencies": {
23
- "chai": "^4.3.9",
24
- "eslint": "^7.32.0",
25
- "eslint-config-airbnb-base": "^14.2.1",
26
- "eslint-plugin-import": "^2.24.2",
23
+ "chai": "^4.3.10",
24
+ "eslint": "^8.53.0",
25
+ "eslint-config-airbnb-base": "^15.0.0",
26
+ "eslint-plugin-import": "^2.29.0",
27
27
  "mocha": "^10.2.0",
28
28
  "should": "^13.2.3",
29
- "sinon": "^11.1.2"
29
+ "sinon": "^17.0.1"
30
30
  }
31
31
  }