}
c.cond.L = new(sync.Mutex)
+ c.bbft = newBbft(store, nil, c.orphanManage, eventDispatcher)
storeStatus := store.GetStoreStatus()
if storeStatus == nil {
if err := c.initChainStatus(); err != nil {
c.bestNode = c.index.GetNode(storeStatus.Hash)
c.bestIrreversibleNode = c.index.GetNode(storeStatus.IrreversibleHash)
c.index.SetMainChain(c.bestNode)
- c.bbft = newBbft(store, c.index, c.orphanManage, eventDispatcher)
+ c.bbft.SetBlockIndex(c.index)
go c.blockProcesser()
return c, nil
}
return err
}
+ voteResultMap := make(map[uint64]*state.VoteResult)
+ if err := c.bbft.ApplyBlock(voteResultMap, genesisBlock); err != nil {
+ return err
+ }
+
node, err := state.NewBlockNode(&genesisBlock.BlockHeader, nil)
if err != nil {
return err
}
- return c.store.SaveChainStatus(node, node, utxoView, map[uint64]*state.VoteResult{})
+ return c.store.SaveChainStatus(node, node, utxoView, voteResultMap)
}
// BestBlockHeight returns the current height of the blockchain.