added getbestblockhash to Status class
This commit is contained in:
parent
c96b6a7598
commit
b2d4e3c327
|
@ -12,6 +12,7 @@ function spec() {
|
||||||
this.info = {};
|
this.info = {};
|
||||||
this.difficulty = {};
|
this.difficulty = {};
|
||||||
this.txoutsetinfo = {};
|
this.txoutsetinfo = {};
|
||||||
|
this.bestblockhash = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Status.prototype.getInfo = function(next) {
|
Status.prototype.getInfo = function(next) {
|
||||||
|
@ -62,6 +63,22 @@ function spec() {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Status.prototype.getBestBlockHash = function(next) {
|
||||||
|
var that = this;
|
||||||
|
async.series([
|
||||||
|
function (cb) {
|
||||||
|
rpc.getBestBlockHash(function(err, bbh){
|
||||||
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
that.bestblockhash = bbh.result;
|
||||||
|
return cb();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
], function (err) {
|
||||||
|
return next(err);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,16 @@ describe('Status', function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('getBestBlockHash', function(done) {
|
||||||
|
var d = new Status();
|
||||||
|
|
||||||
|
d.getBestBlockHash(function(err) {
|
||||||
|
if (err) done(err);
|
||||||
|
assert.equal('string', typeof d.bestblockhash);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue