Merge pull request #381 from kleetus/feature/remove_getTxOutSetInfo
Removed unneeded and slow getTxOutSetInfo
This commit is contained in:
commit
8625c23e81
@ -220,7 +220,6 @@ Where "xxx" can be:
|
||||
|
||||
* getInfo
|
||||
* getDifficulty
|
||||
* getTxOutSetInfo
|
||||
* getBestBlockHash
|
||||
* getLastBlockHash
|
||||
|
||||
|
||||
@ -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 {
|
||||
|
||||
@ -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: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user