Update chain prevHash cache.

This commit is contained in:
Braydon Fuller 2015-07-24 23:18:14 -04:00
parent 9890a4f0da
commit 4f281dcefe
2 changed files with 7 additions and 1 deletions

View File

@ -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) {

View File

@ -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) {