-func (c *consensusNodeManager) reorganizeVoteResult(voteResult *state.VoteResult, forkChainNode *state.BlockNode) error {
- genesisBlockHash := config.GenesisBlock().Hash()
- mainChainNode := c.blockIndex.GetNode(&genesisBlockHash)
-
- emptyHash := bc.Hash{}
- if voteResult.LastBlockHash != emptyHash {
- mainChainNode = c.blockIndex.GetNode(&voteResult.LastBlockHash)
- if mainChainNode == nil {
- return errNotFoundBlockNode
- }
- }
-
- var attachNodes []*state.BlockNode
- var detachNodes []*state.BlockNode
+func (c *Chain) getBestConsensusResult() (*state.ConsensusResult, error) {
+ bestBlockHeader := c.bestBlockHeader
+ seq := state.CalcVoteSeq(bestBlockHeader.Height)
+ return c.getConsensusResult(seq, bestBlockHeader)
+}