Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bitcoin-inventory

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitcoin-inventory - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

2

index.js

@@ -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
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc