diff --git a/lib/node.js b/lib/node.js index ca0160c6..667fc3db 100644 --- a/lib/node.js +++ b/lib/node.js @@ -220,6 +220,9 @@ Node.prototype._syncBitcoind = function() { // Populate height block.__height = self.chain.tip.__height + 1; + // Update chain hashes + self.chain.cache.hashes[block.hash] = block.prevHash; + // Create indexes self.db._onChainAddBlock(block, function(err) { if (err) { diff --git a/test/node.unit.js b/test/node.unit.js index 97cee6e7..33b447d4 100644 --- a/test/node.unit.js +++ b/test/node.unit.js @@ -177,7 +177,10 @@ describe('Bitcoind Node', function() { hash: block.prevHash }, saveMetadata: sinon.stub(), - emit: sinon.stub() + emit: sinon.stub(), + cache: { + hashes: {} + } }; node.db = { _onChainAddBlock: function(block, callback) {