CheckProtocolVersion() compares the protocol version against the governance enforced version
()
| 109 | |
| 110 | // CheckProtocolVersion() compares the protocol version against the governance enforced version |
| 111 | func (s *StateMachine) CheckProtocolVersion() (err lib.ErrorI) { |
| 112 | // get the governance parameters |
| 113 | params, err := s.GetParamsCons() |
| 114 | if err != nil { |
| 115 | return |
| 116 | } |
| 117 | // get the protocol version |
| 118 | version, err := params.ParseProtocolVersion() |
| 119 | if err != nil { |
| 120 | return |
| 121 | } |
| 122 | // ensure that the software version is correct |
| 123 | if s.Height() >= version.Height && s.ProtocolVersion < version.Version { |
| 124 | return ErrInvalidProtocolVersion() |
| 125 | } |
| 126 | return |
| 127 | } |
| 128 | |
| 129 | // HandleCertificateResults() is a handler for the results of a quorum certificate |
| 130 | func (s *StateMachine) HandleCertificateResults(qc *lib.QuorumCertificate, committee *lib.ValidatorSet) lib.ErrorI { |