Skip to content

Commit

Permalink
fix sync percentage
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Nagurny committed Oct 22, 2015
1 parent d806500 commit c7231f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ StatusController.prototype.sync = function(req, res) {
var info = {
status: status,
blockChainHeight: this.node.services.bitcoind.height,
syncPercentage: this.node.services.db.tip.__height / this.node.services.bitcoind.height * 100,
syncPercentage: Math.round(this.node.services.bitcoind.syncPercentage() * 100),
height: this.node.services.db.tip.__height,
error: null,
type: 'bitcore node'
Expand Down
3 changes: 2 additions & 1 deletion test/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ describe('Status', function() {
},
bitcoind: {
height: 500000,
isSynced: sinon.stub().returns(true)
isSynced: sinon.stub().returns(true),
syncPercentage: sinon.stub().returns(.9999)
}
}
};
Expand Down

0 comments on commit c7231f0

Please sign in to comment.