bitcoin-inventory
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,1 +0,1 @@ | ||
module.exports = require('./lib') | ||
module.exports = require('./src') |
{ | ||
"name": "bitcoin-inventory", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Exchange transactions with peers", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard src test && nyc tape test/*.js | faucet && nyc report", | ||
"test-browser": "npm run build && test/browser.sh && npm run source", | ||
"build": "rm -rf lib && babel --presets es2015 src -d lib", | ||
"source": "rm -rf lib && ln -s src lib", | ||
"prepublish": "npm run build", | ||
"publish": "npm run source" | ||
"pretest": "depcheck --ignores=airtap && standard", | ||
"test": "npm run pretest && nyc tape test/*.js | faucet && nyc report", | ||
"test-browser": "npm run pretest && test/browser.sh" | ||
}, | ||
@@ -27,4 +24,4 @@ "keywords": [ | ||
"dependencies": { | ||
"bitcoin-protocol": "^3.0.1", | ||
"buffer-reverse": "^1.0.1", | ||
"bitcoin-protocol": "^4.0.1", | ||
"create-hash": "^1.2.0", | ||
"map-deque": "0.0.2", | ||
@@ -34,12 +31,10 @@ "old": "^0.1.3" | ||
"devDependencies": { | ||
"babel-cli": "^6.9.0", | ||
"babel-preset-es2015": "^6.9.0", | ||
"airtap": "^0.1.0", | ||
"depcheck": "^0.6.11", | ||
"event-cleanup": "^1.0.3", | ||
"faucet": "0.0.1", | ||
"nyc": "^6.4.4", | ||
"standard": "^7.1.1", | ||
"tape": "^4.5.1", | ||
"zuul": "^3.10.1", | ||
"zuul-ngrok": "^4.0.0" | ||
"standard": "^12.0.1", | ||
"tape": "^4.5.1" | ||
} | ||
} |
@@ -18,3 +18,3 @@ 'use strict' | ||
if (!peers) { | ||
throw new Error('Must provide "peers" argument') | ||
throw Error('Must provide "peers" argument') | ||
} | ||
@@ -30,2 +30,3 @@ super() | ||
this.peers.on('getdata', this._onGetdata.bind(this)) | ||
this.peers.on('reject', this._onReject.bind(this)) | ||
@@ -43,3 +44,3 @@ this.lastCount = 0 | ||
if (this.requesting[hash] || this.data.has(hash)) continue | ||
item.hash = item.hash.reverse() | ||
item.hash = reverse(item.hash) | ||
getData.push(item) | ||
@@ -54,8 +55,8 @@ this.requesting[hash] = true | ||
_onTx (tx, peer = this.peers) { | ||
let hash = hashToString(getTxHash(tx)) | ||
delete this.requesting[hash] | ||
if (this.data.has(hash)) return | ||
let hash = getTxHash(tx) | ||
let hashStr = hashToString(hash) | ||
delete this.requesting[hashStr] | ||
if (this.data.has(hashStr)) return | ||
this._add(tx, false) | ||
this.emit('tx', tx, peer) | ||
this.emit(`tx:${hash}`, tx, peer) | ||
} | ||
@@ -74,2 +75,6 @@ | ||
_onReject (message, peer = this.peers) { | ||
console.log('got reject', message) | ||
} | ||
_removeOld () { | ||
@@ -114,4 +119,10 @@ for (let i = 0; i < this.lastCount; i++) { | ||
function reverse (buf) { | ||
let clone = Buffer.allocUnsafe(buf.length) | ||
buf.copy(clone) | ||
return clone.reverse() | ||
} | ||
function hashToString (hash) { | ||
return hash.reverse().toString('hex') | ||
return reverse(hash).toString('base64') | ||
} | ||
@@ -129,1 +140,3 @@ | ||
module.exports = old(Inventory) | ||
module.exports.getTxHash = getTxHash | ||
module.exports.reverse = reverse |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7
6576
4
115
1
+ Addedcreate-hash@^1.2.0
+ Addedbitcoin-protocol@4.1.3(transitive)
- Removedbuffer-reverse@^1.0.1
- Removedbitcoin-protocol@3.0.1(transitive)
- Removedbuffer-equals@1.0.4(transitive)
- Removedbuffer-reverse@1.0.1(transitive)
- Removedfrom2@2.3.0(transitive)
Updatedbitcoin-protocol@^4.0.1