From 35ff54aea72794b1b1cbd84d4ebe15c57f87e992 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Thu, 16 Jan 2014 15:07:37 -0300 Subject: [PATCH] remove call to getBestBlockHash (not in all bitcoind clients) --- lib/Sync.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/Sync.js b/lib/Sync.js index 92b89afa..2e425ba1 100644 --- a/lib/Sync.js +++ b/lib/Sync.js @@ -293,6 +293,7 @@ function spec() { var retry_secs = 2; var block_best; + var block_height; this.db.once('open', function() { async.series([ @@ -328,10 +329,20 @@ function spec() { return cb(); }); }, + // We are not using getBestBlockHash, because is not available in all clients function(cb) { if (!opts.reverse) return cb(); - that.rpc.getBestBlockHash(function(err, res) { + that.rpc.getBlockCount(function(err, res) { + if (err) cb(err); + block_height = res.result; + return cb(); + }); + }, + function(cb) { + if (!opts.reverse) return cb(); + + that.rpc.getBlockHash(block_height, function(err, res) { if (err) cb(err); block_best = res.result;