// Messages that match an acknowledgement, and are added to the process list // all do the same thing. So that logic is here. func (s *State) MatchAckFollowerExecute(m interfaces.IMsg) error { acks := s.GetAcks() ack, ok := acks[m.GetHash().Fixed()].(*messages.Ack) if !ok || ack == nil { s.GetHolding()[m.GetHash().Fixed()] = m } else { processlist := s.GetProcessList()[ack.ServerIndex] for len(processlist) < ack.Height+1 { processlist = append(processlist, nil) } processlist[ack.Height] = m s.GetProcessList()[ack.ServerIndex] = processlist delete(acks, m.GetHash().Fixed()) } return nil }
// Returns true if message is new func MsgIsNew(msg interfaces.IMsg) bool { oldsync.Lock() defer oldsync.Unlock() return old[msg.GetHash().Fixed()] == nil }
func SetMsg(msg interfaces.IMsg) { oldsync.Lock() old[msg.GetHash().Fixed()] = msg oldsync.Unlock() }
func (p *ProcessList) AddOldMsgs(m interfaces.IMsg) { p.oldmsgslock.Lock() defer p.oldmsgslock.Unlock() p.OldMsgs[m.GetHash().Fixed()] = m }