// When REQUEST message is broadcasted, start consensus.
When REQUEST message is broadcasted, start consensus.
// When REQUEST message is broadcasted start consensus .
func (node *Node) GetReq(reqMsg *consensus.RequestMsg) {
	LogMsg(reqMsg)
	if node.IsViewChanging == true {
		return
	}
	state := node.createState(reqMsg.Timestamp)
	newTotalConsensus := atomic.AddInt64(&node.TotalConsensus, 1)
	prePrepareMsg := state.StartConsensus(reqMsg, newTotalConsensus)
	node.StatesMutex.Lock()
	node.States[prePrepareMsg.SequenceID] = state
	node.StatesMutex.Unlock()
	fmt.Printf("Consensus Process (ViewID: %d, SequenceID: %d)\n",
	           prePrepareMsg.ViewID, prePrepareMsg.SequenceID)
	LogStage("Request", true)
	if node.isMyNodePrimary() {
		node.Broadcast(prePrepareMsg, "/preprepare")
	}
	LogStage("Pre-prepare", false)
	Deadline is determined by the timestamp of the current node.
	go node.startTransitionWithDeadline(state, time.Now().UnixNano())
}
func ( node * Node ) GetReq ( reqMsg * consensus . RequestMsg ) { LogMsg ( reqMsg ) if node . IsViewChanging == true { return } state := node . createState ( reqMsg . Timestamp ) newTotalConsensus := atomic . AddInt64 ( & node . TotalConsensus , 1 ) prePrepareMsg := state . StartConsensus ( reqMsg , newTotalConsensus ) node . StatesMutex . Lock ( ) node . States [ prePrepareMsg . SequenceID ] = state node . StatesMutex . Unlock ( ) fmt . Printf ( " \n " , prePrepareMsg . ViewID , prePrepareMsg . SequenceID ) LogStage ( " " , true ) if node . isMyNodePrimary ( ) { node . Broadcast ( prePrepareMsg , " " ) } LogStage ( " " , false ) go node . startTransitionWithDeadline ( state , time . Now ( ) . UnixNano ( ) ) }
When REQUEST message is broadcasted, start consensus.
When REQUEST message is broadcasted start consensus .
// Create a new state object. // Increment the number of request message atomically. // TODO: Currently, StartConsensus must succeed. // Register state into node and update last sequence number. // Broadcast PrePrepare message. // From TOCS: The backups check the sequence numbers assigned by // the primary and use timeouts to detect when it stops. // They trigger view changes to select a new primary when it // appears that the current one has failed. //  // Deadline is determined by the timestamp of the current node.