From 999a669c53bdb860ff61c1f918bd150a49548c24 Mon Sep 17 00:00:00 2001 From: Chris Kleeschulte Date: Fri, 25 Sep 2015 11:17:20 -0400 Subject: [PATCH] Removed unneeded and slow getTxOutSetInfo --- README.md | 1 - lib/status.js | 17 ----------------- test/status.js | 32 -------------------------------- 3 files changed, 50 deletions(-) diff --git a/README.md b/README.md index 2ba09bb..7d4273e 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,6 @@ Where "xxx" can be: * getInfo * getDifficulty - * getTxOutSetInfo * getBestBlockHash * getLastBlockHash diff --git a/lib/status.js b/lib/status.js index 750550c..2275adf 100644 --- a/lib/status.js +++ b/lib/status.js @@ -12,9 +12,6 @@ StatusController.prototype.show = function(req, res) { case 'getDifficulty': res.jsonp(this.getDifficulty()); break; - case 'getTxOutSetInfo': - res.jsonp(this.getTxOutSetInfo()); - break; case 'getLastBlockHash': res.jsonp(this.getLastBlockHash()); break; @@ -34,20 +31,6 @@ StatusController.prototype.getInfo = function() { }; }; -StatusController.prototype.getTxOutSetInfo = function() { - var hash = this.node.services.bitcoind.getBestBlockHash(); - if (hash === this.lastTxOutSetInfo) { - return { - txoutsetinfo: this.txOutSetInfo - }; - } - this.txOutSetInfo = this.node.services.bitcoind.getTxOutSetInfo(); - this.lastTxOutSetInfo = this.txOutSetInfo.bestblock; - return { - txoutsetinfo: this.txOutSetInfo - }; -}; - StatusController.prototype.getLastBlockHash = function() { var hash = this.node.services.db.tip.hash; return { diff --git a/test/status.js b/test/status.js index 9f9ee1b..1fff1f9 100644 --- a/test/status.js +++ b/test/status.js @@ -32,7 +32,6 @@ describe('Status', function() { services: { bitcoind: { getInfo: sinon.stub().returns(info), - getTxOutSetInfo: sinon.stub().returns(outSetInfo), getBestBlockHash: sinon.stub().returns(outSetInfo.bestblock) }, db: { @@ -82,37 +81,6 @@ describe('Status', function() { status.show(req, res); }); - it('getTxOutSetInfo', function(done) { - var req = { - query: { - q: 'getTxOutSetInfo' - } - }; - var res = { - jsonp: function(data) { - data.txoutsetinfo.should.equal(outSetInfo); - done(); - } - }; - status.show(req, res); - }); - - it('getTxOutSetInfo (cached)', function(done) { - var req = { - query: { - q: 'getTxOutSetInfo' - } - }; - var res = { - jsonp: function(data) { - data.txoutsetinfo.should.equal(outSetInfo); - done(); - } - }; - status.node.services.bitcoind.getTxOutSetInfo.callCount.should.equal(1); - status.show(req, res); - }); - it('getBestBlockHash', function(done) { var req = { query: {