Update chain prevHash cache.
This commit is contained in:
parent
9890a4f0da
commit
4f281dcefe
@ -220,6 +220,9 @@ Node.prototype._syncBitcoind = function() {
|
|||||||
// Populate height
|
// Populate height
|
||||||
block.__height = self.chain.tip.__height + 1;
|
block.__height = self.chain.tip.__height + 1;
|
||||||
|
|
||||||
|
// Update chain hashes
|
||||||
|
self.chain.cache.hashes[block.hash] = block.prevHash;
|
||||||
|
|
||||||
// Create indexes
|
// Create indexes
|
||||||
self.db._onChainAddBlock(block, function(err) {
|
self.db._onChainAddBlock(block, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|||||||
@ -177,7 +177,10 @@ describe('Bitcoind Node', function() {
|
|||||||
hash: block.prevHash
|
hash: block.prevHash
|
||||||
},
|
},
|
||||||
saveMetadata: sinon.stub(),
|
saveMetadata: sinon.stub(),
|
||||||
emit: sinon.stub()
|
emit: sinon.stub(),
|
||||||
|
cache: {
|
||||||
|
hashes: {}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
node.db = {
|
node.db = {
|
||||||
_onChainAddBlock: function(block, callback) {
|
_onChainAddBlock: function(block, callback) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user