From dac973c65fc5a7ca405b6617e5cf4295f456132e Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Wed, 8 Jan 2014 01:40:57 -0300 Subject: [PATCH] tx syncing v2 --- Sync.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Sync.js b/Sync.js index 788dbddd..ae7d23ef 100644 --- a/Sync.js +++ b/Sync.js @@ -16,6 +16,12 @@ function spec(b) { this.network = config.networkName == 'testnet' ? networks.testnet : networks.livenet; } + var progress_bar = function(string, current, total) { + console.log( util.format("\t%s %d/%d [%d%%]", + string, current, total, parseInt(100 * current/total)) + ); + } + Sync.prototype.getNextBlock = function (blockHash,cb) { var that = this; @@ -29,7 +35,7 @@ function spec(b) { 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))); + progress_bar('height', h, h + d); } Block.create( blockInfo.result, function(err, inBlock) { @@ -76,12 +82,6 @@ function spec(b) { } - var progress_bar = function(string, current, total) { - console.log( util.format("\t%s %d/%d [%d%%]", - string, current, total, parseInt(100 * current/total)) - ); - } - Sync.prototype.syncTXs = function (reindex, cb) { var that = this; @@ -92,7 +92,7 @@ function spec(b) { } - Transaction.find({blockHash: null}, function(err, txs) { + Transaction.find({blockhash: null}, function(err, txs) { if (err) return cb(err); var read = 0;