diff --git a/app/models/Status.js b/app/models/Status.js index 2ddffc4..be5149c 100644 --- a/app/models/Status.js +++ b/app/models/Status.js @@ -11,6 +11,7 @@ function spec() { function Status() { this.info = {}; this.difficulty = {}; + this.txoutsetinfo = {}; } Status.prototype.getInfo = function(next) { @@ -45,6 +46,22 @@ function spec() { }); }; + Status.prototype.getTxOutSetInfo = function(next) { + var that = this; + async.series([ + function (cb) { + rpc.getTxOutSetInfo(function(err, txout){ + if (err) return cb(err); + + that.txoutsetinfo = txout.result; + return cb(); + }); + } + ], function (err) { + return next(err); + }); + }; + return Status; } diff --git a/test/model/status.js b/test/model/status.js index e1c22bc..0795ecb 100644 --- a/test/model/status.js +++ b/test/model/status.js @@ -40,5 +40,15 @@ describe('Status', function(){ }); }); + it('getTxOutSetInfo', function(done) { + var d = new Status(); + + d.getTxOutSetInfo(function(err) { + if (err) done(err); + assert.equal('number', typeof d.txoutsetinfo.txouts); + done(); + }); + }); + });