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.0.1 to 1.0.2

14

lib/index.js

@@ -34,3 +34,3 @@ 'use strict';

_this.ttl = opts.ttl != null ? opts.ttl : 2 * 60 * 1000;
var ttl = opts.ttl != null ? opts.ttl : 2 * 60 * 1000;
_this.peers = peers;

@@ -45,2 +45,4 @@ _this.data = new MapDeque();

_this.lastCount = 0;
_this.interval = setInterval(_this._removeOld.bind(_this), ttl);
if (_this.interval.unref) _this.interval.unref();
return _this;

@@ -141,7 +143,2 @@ }

this.lastCount = this.data.length;
if (this.data.length === 0) {
this.timeout = null;
} else {
this.timeout = setTimeout(this._removeOld.bind(this), this.ttl);
}
}

@@ -151,5 +148,2 @@ }, {

value: function _add(tx, broadcast) {
if (!this.timeout) {
this.timeout = setTimeout(this._removeOld.bind(this), this.ttl);
}
var hashBuf = tx.getHash();

@@ -183,3 +177,3 @@ var hash = getHash(hashBuf);

value: function close() {
clearTimeout(this.timeout);
clearInterval(this.interval);
// TODO: stop listening to peers

@@ -186,0 +180,0 @@ }

{
"name": "bitcoin-inventory",
"version": "1.0.1",
"version": "1.0.2",
"description": "Exchange transactions with peers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -18,3 +18,3 @@ 'use strict'

super()
this.ttl = opts.ttl != null ? opts.ttl : 2 * 60 * 1000
var ttl = opts.ttl != null ? opts.ttl : 2 * 60 * 1000
this.peers = peers

@@ -29,2 +29,4 @@ this.data = new MapDeque()

this.lastCount = 0
this.interval = setInterval(this._removeOld.bind(this), ttl)
if (this.interval.unref) this.interval.unref()
}

@@ -71,13 +73,5 @@

this.lastCount = this.data.length
if (this.data.length === 0) {
this.timeout = null
} else {
this.timeout = setTimeout(this._removeOld.bind(this), this.ttl)
}
}
_add (tx, broadcast) {
if (!this.timeout) {
this.timeout = setTimeout(this._removeOld.bind(this), this.ttl)
}
var hashBuf = tx.getHash()

@@ -109,3 +103,3 @@ var hash = getHash(hashBuf)

close () {
clearTimeout(this.timeout)
clearInterval(this.interval)
// TODO: stop listening to peers

@@ -112,0 +106,0 @@ }

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