Example #1
0
func (s *PeerState) ProcessHello(hello *protocol.Hello) error {
	s.mu.Lock()
	defer s.mu.Unlock()
	s.CurrentLedger = hello.GetLedgerIndex()
	s.Name = hello.GetFullVersion()
	s.MajorVersion = hello.GetProtoVersion()
	s.MinorVersion = hello.GetProtoVersionMin()
	var err error
	s.PublicKey, err = crypto.NewRippleHash(string(hello.NodePublic))
	if err != nil {
		s.Status = HelloFailed
		return fmt.Errorf("Bad node public key: %s", hello.NodePublic)
	}
	s.Status = Verified
	return nil
}