本文整理匯總了Golang中github.com/FactomProject/factomd/common/interfaces.IMsg.FollowerExecute方法的典型用法代碼示例。如果您正苦於以下問題:Golang IMsg.FollowerExecute方法的具體用法?Golang IMsg.FollowerExecute怎麽用?Golang IMsg.FollowerExecute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/FactomProject/factomd/common/interfaces.IMsg
的用法示例。
在下文中一共展示了IMsg.FollowerExecute方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: executeMsg
func (s *State) executeMsg(vm *VM, msg interfaces.IMsg) (ret bool) {
_, ok := s.Replay.Valid(constants.INTERNAL_REPLAY, msg.GetRepeatHash().Fixed(), msg.GetTimestamp(), s.GetTimestamp())
if !ok {
return
}
s.SetString()
msg.ComputeVMIndex(s)
switch msg.Validate(s) {
case 1:
if s.RunLeader &&
s.Leader &&
!s.Saving &&
vm != nil && int(vm.Height) == len(vm.List) &&
(!s.Syncing || !vm.Synced) &&
(msg.IsLocal() || msg.GetVMIndex() == s.LeaderVMIndex) &&
s.LeaderPL.DBHeight+1 >= s.GetHighestKnownBlock() {
if len(vm.List) == 0 {
s.SendDBSig(s.LLeaderHeight, s.LeaderVMIndex)
s.XReview = append(s.XReview, msg)
} else {
msg.LeaderExecute(s)
}
} else {
msg.FollowerExecute(s)
}
ret = true
case 0:
s.Holding[msg.GetMsgHash().Fixed()] = msg
default:
s.Holding[msg.GetMsgHash().Fixed()] = msg
if !msg.SentInvlaid() {
msg.MarkSentInvalid(true)
s.networkInvalidMsgQueue <- msg
}
}
return
}
示例2: LeaderExecuteRevealEntry
func (s *State) LeaderExecuteRevealEntry(m interfaces.IMsg) {
re := m.(*messages.RevealEntryMsg)
eh := re.Entry.GetHash()
commit, rtn := re.ValidateRTN(s)
switch rtn {
case 0:
m.FollowerExecute(s)
case -1:
return
}
now := s.GetTimestamp()
// If we have already recorded a Reveal Entry with this hash in this period, just ignore.
if _, v := s.Replay.Valid(constants.REVEAL_REPLAY, eh.Fixed(), s.GetLeaderTimestamp(), now); !v {
return
}
ack := s.NewAck(m).(*messages.Ack)
m.SetLeaderChainID(ack.GetLeaderChainID())
m.SetMinute(ack.Minute)
// Put the acknowledgement in the Acks so we can tell if AddToProcessList() adds it.
s.Acks[m.GetMsgHash().Fixed()] = ack
s.ProcessLists.Get(ack.DBHeight).AddToProcessList(ack, m)
// If it was added, then get rid of the matching Commit.
if s.Acks[m.GetMsgHash().Fixed()] != nil {
m.FollowerExecute(s)
s.PutCommit(eh, commit)
} else {
// Okay the Reveal has been recorded. Record this as an entry that cannot be duplicated.
s.Replay.IsTSValid_(constants.REVEAL_REPLAY, eh.Fixed(), m.GetTimestamp(), now)
delete(s.Commits, eh.Fixed())
}
}