diff --git a/lib/services/db/index.js b/lib/services/db/index.js index b6cb3b54..03d9647e 100644 --- a/lib/services/db/index.js +++ b/lib/services/db/index.js @@ -157,7 +157,6 @@ DB.prototype.start = function(callback) { mkdirp.sync(this.dataPath); } - self.genesis = Block.fromBuffer(self.bitcoind.genesisBuffer); self._store = levelup(self.dataPath, { db: self.levelupStore, keyEncoding: 'binary', valueEncoding: 'binary'}); self.store = { @@ -170,6 +169,7 @@ DB.prototype.start = function(callback) { self.node.once('ready', function() { + self.genesis = Block.fromBuffer(self.bitcoind.genesisBuffer); self.loadTips(function(err) { if(err) { diff --git a/lib/services/db/sync.js b/lib/services/db/sync.js index c470fa07..b1137bb1 100644 --- a/lib/services/db/sync.js +++ b/lib/services/db/sync.js @@ -260,6 +260,7 @@ BlockStream.prototype._getBlocks = function(heights, callback) { } self.push(null); + callback(); }); };