-// GetVoteResultByHash return vote result by block hash
-func (c *Chain) GetVoteResultByHash(blockHash *bc.Hash) (*state.VoteResult, error) {
- blockNode := c.index.GetNode(blockHash)
- return c.consensusNodeManager.getVoteResult(state.CalcVoteSeq(blockNode.Height), blockNode)
-}
-
-// IsBlocker returns whether the consensus node is a blocker at the specified time
-func (c *Chain) IsBlocker(prevBlockHash *bc.Hash, pubkey string, timeStamp uint64) (bool, error) {
- return c.consensusNodeManager.isBlocker(prevBlockHash, pubkey, timeStamp)
-}
-
-// ProcessBlockSignature process the received block signature messages
-// return whether a block become irreversible, if so, the chain module must update status
-func (c *Chain) ProcessBlockSignature(signature, xPub []byte, blockHash *bc.Hash) error {
- xpubStr := hex.EncodeToString(xPub[:])
- blockNode := c.index.GetNode(blockHash)
- // save the signature if the block is not exist
- if blockNode == nil {
- cacheKey := signCacheKey(blockHash.String(), xpubStr)
- c.signatureCache.Add(cacheKey, signature)
- return nil
- }
-
- consensusNode, err := c.consensusNodeManager.getConsensusNode(&blockNode.Parent.Hash, xpubStr)
- if err != nil {
+func (c *Chain) updateBlockSignature(blockHeader *types.BlockHeader, nodeOrder uint64, signature []byte) error {
+ blockHeader.Set(nodeOrder, signature)
+ if err := c.store.SaveBlockHeader(blockHeader); err != nil {