@dashevo/dash-spv
Advanced tools
Comparing version 1.1.7-5 to 1.1.7
@@ -56,2 +56,3 @@ const levelup = require('levelup'); | ||
module.exports = BlockStore; |
@@ -9,3 +9,3 @@ const { hasValidTarget } = require('@dashevo/dark-gravity-wave'); | ||
function getMedianTimestamp(headers) { | ||
const timestamps = headers.map((h) => h.time); | ||
const timestamps = headers.map(h => h.time); | ||
const median = (arr) => { | ||
@@ -26,3 +26,3 @@ const mid = Math.floor(arr.length / 2); | ||
Math.max(previousHeaders.length - MIN_TIMESTAMP_HEADERS, 0), | ||
).map((h) => utils.normalizeHeader(h)); | ||
).map(h => utils.normalizeHeader(h)); | ||
return getMedianTimestamp(normalizedLatestHeaders) < headerNormalised.time; | ||
@@ -37,3 +37,3 @@ } | ||
&& hasValidTarget( | ||
utils.getDgwBlock(newHeader), previousHeaders.map((h) => utils.getDgwBlock(h)), network, | ||
utils.getDgwBlock(newHeader), previousHeaders.map(h => utils.getDgwBlock(h)), network, | ||
); | ||
@@ -40,0 +40,0 @@ } |
@@ -14,6 +14,6 @@ const DashUtil = require('@dashevo/dash-util'); | ||
if (typeof transactions[0] === 'string') { | ||
txToFilter = txToFilter.map((tx) => DashUtil.toHash(tx).toString('hex')); | ||
txToFilter = txToFilter.map(tx => DashUtil.toHash(tx).toString('hex')); | ||
} | ||
return merkleBlock.validMerkleTree | ||
&& txToFilter.filter((tx) => merkleBlock.hasTransaction(tx)).length === transactions.length; | ||
&& txToFilter.filter(tx => merkleBlock.hasTransaction(tx)).length === transactions.length; | ||
}, | ||
@@ -20,0 +20,0 @@ }; |
const BlockStore = require('./blockstore'); | ||
const config = require('../config/config'); | ||
const Consensus = require('./consensus'); | ||
const utils = require('./utils'); | ||
const utils = require('../lib/utils'); | ||
@@ -133,5 +133,5 @@ const SpvChain = class { | ||
isDuplicate(compareHash) { | ||
return this.getAllBranches().map((branch) => branch.map((node) => node.hash)) | ||
.concat(this.orphanBlocks.map((orphan) => orphan.hash)) | ||
.filter((hash) => hash === compareHash).length > 0; | ||
return this.getAllBranches().map(branch => branch.map(node => node.hash)) | ||
.concat(this.orphanBlocks.map(orphan => orphan.hash)) | ||
.filter(hash => hash === compareHash).length > 0; | ||
} | ||
@@ -258,3 +258,3 @@ | ||
return this.getLongestChain().filter((h) => h.hash === hash)[0]; | ||
return this.getLongestChain().filter(h => h.hash === hash)[0]; | ||
}); | ||
@@ -300,3 +300,3 @@ } | ||
} | ||
const normalizedHeaders = headers.map((h) => utils.normalizeHeader(h)); | ||
const normalizedHeaders = headers.map(h => utils.normalizeHeader(h)); | ||
const isOrphan = !SpvChain.isParentChild(normalizedHeaders[0], this.getTipHeader()); | ||
@@ -303,0 +303,0 @@ |
{ | ||
"name": "@dashevo/dash-spv", | ||
"version": "1.1.7-5", | ||
"version": "1.1.7", | ||
"description": "Repository containing SPV functions used by @dashevo", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -216,2 +216,2 @@ /* eslint no-underscore-dangle: ["error", { "allow": ["_getHash"] }] */ | ||
module.exports = headers.map((h) => utils.normalizeHeader(h)); | ||
module.exports = headers.map(h => utils.normalizeHeader(h)); |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
961128