add percentage status to sync

This commit is contained in:
Matias Alejo Garcia 2014-01-07 09:11:01 -03:00
parent 4425b43f2f
commit b1a439e688
1 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
require('buffertools').extend();
var util = require('util');
var RpcClient = require('../node_modules/bitcore/RpcClient').class();
var networks = require('../node_modules/bitcore/networks');
@ -26,8 +27,11 @@ function getNextBlock(blockHash,cb) {
return cb(err);
}
if ( ! ( blockInfo.result.height % 1000) )
console.log("Height:" + blockInfo.result.height);
if ( ! ( blockInfo.result.height % 1000) ) {
var h = blockInfo.result.height,
d = blockInfo.result.confirmations;
console.log( util.format("Height: %d/%d [%d%%]", h, d, 100*h/(h+d)));
}
Block.create( blockInfo.result, function(err, inBlock) {