From b1a439e688c67dce8e7fd79a3e1e6745eb57f830 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Tue, 7 Jan 2014 09:11:01 -0300 Subject: [PATCH] add percentage status to sync --- util/sync.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/util/sync.js b/util/sync.js index 2cb5d5e..78991de 100755 --- a/util/sync.js +++ b/util/sync.js @@ -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) {