-
-func (b *bbft) updateBlockSignature(block *types.Block, nodeOrder uint64, signature []byte) error {
- blockHash := block.Hash()
- blockNode := b.consensusNodeManager.blockIndex.GetNode(&blockHash)
-
- if len(signature) != 0 {
- if err := blockNode.BlockWitness.Set(uint32(nodeOrder)); err != nil {
- return err
- }
- } else {
- if err := blockNode.BlockWitness.Clean(uint32(nodeOrder)); err != nil {
- return err
- }
- }
-
- block.Witness[nodeOrder] = signature
- txStatus, err := b.consensusNodeManager.store.GetTransactionStatus(&blockHash)
- if err != nil {
- return err
- }
-
- return b.consensusNodeManager.store.SaveBlock(block, txStatus)
-}
-
-// SetBlockIndex set the block index field
-func (b *bbft) SetBlockIndex(blockIndex *state.BlockIndex) {
- b.consensusNodeManager.blockIndex = blockIndex
-}