Set best chain during GenerateInitialIndex.

This commit modifies the GenerateInitialIndex function to update the best
chain with each node as it is loaded.  This allows the best chain to be
set immediately upon generating the initial index which is a slight
performance optimization.
This commit is contained in:
Dave Collins 2013-08-28 10:42:38 -05:00
parent d0be0ed5ed
commit fc1b2e54d3

View file

@ -379,10 +379,13 @@ func (b *BlockChain) GenerateInitialIndex() error {
return err return err
} }
_, err = b.loadBlockNode(hash) node, err := b.loadBlockNode(hash)
if err != nil { if err != nil {
return err return err
} }
// This node is now the end of the best chain.
b.bestChain = node
} }
return nil return nil