Removed unneeded and slow getTxOutSetInfo
This commit is contained in:
parent
bb0412f1c8
commit
999a669c53
@ -220,7 +220,6 @@ Where "xxx" can be:
|
|||||||
|
|
||||||
* getInfo
|
* getInfo
|
||||||
* getDifficulty
|
* getDifficulty
|
||||||
* getTxOutSetInfo
|
|
||||||
* getBestBlockHash
|
* getBestBlockHash
|
||||||
* getLastBlockHash
|
* getLastBlockHash
|
||||||
|
|
||||||
|
|||||||
@ -12,9 +12,6 @@ StatusController.prototype.show = function(req, res) {
|
|||||||
case 'getDifficulty':
|
case 'getDifficulty':
|
||||||
res.jsonp(this.getDifficulty());
|
res.jsonp(this.getDifficulty());
|
||||||
break;
|
break;
|
||||||
case 'getTxOutSetInfo':
|
|
||||||
res.jsonp(this.getTxOutSetInfo());
|
|
||||||
break;
|
|
||||||
case 'getLastBlockHash':
|
case 'getLastBlockHash':
|
||||||
res.jsonp(this.getLastBlockHash());
|
res.jsonp(this.getLastBlockHash());
|
||||||
break;
|
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() {
|
StatusController.prototype.getLastBlockHash = function() {
|
||||||
var hash = this.node.services.db.tip.hash;
|
var hash = this.node.services.db.tip.hash;
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -32,7 +32,6 @@ describe('Status', function() {
|
|||||||
services: {
|
services: {
|
||||||
bitcoind: {
|
bitcoind: {
|
||||||
getInfo: sinon.stub().returns(info),
|
getInfo: sinon.stub().returns(info),
|
||||||
getTxOutSetInfo: sinon.stub().returns(outSetInfo),
|
|
||||||
getBestBlockHash: sinon.stub().returns(outSetInfo.bestblock)
|
getBestBlockHash: sinon.stub().returns(outSetInfo.bestblock)
|
||||||
},
|
},
|
||||||
db: {
|
db: {
|
||||||
@ -82,37 +81,6 @@ describe('Status', function() {
|
|||||||
status.show(req, res);
|
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) {
|
it('getBestBlockHash', function(done) {
|
||||||
var req = {
|
var req = {
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user