Optimistic sign prepare

pull/1071/head
Rongjian Lan 6 years ago committed by chaosma
parent b794b58bce
commit 796dc630bb
  1. 7
      consensus/consensus_v2.go

@ -1,6 +1,7 @@
package consensus
import (
"bytes"
"encoding/binary"
"time"
@ -402,6 +403,12 @@ func (consensus *Consensus) onPrepared(msg *msg_pb.Message) {
consensus.aggregatedPrepareSig = aggSig
consensus.prepareBitmap = mask
// Optimistically sign on the blockhash of prepare message
emptyHash := [32]byte{}
if bytes.Compare(consensus.blockHash[:], emptyHash[:]) == 0 {
copy(consensus.blockHash[:], blockHash[:])
}
// Construct and send the commit message
blockNumBytes := make([]byte, 8)
binary.LittleEndian.PutUint64(blockNumBytes, consensus.blockNum)

Loading…
Cancel
Save