MCPcopy
hub / github.com/canopy-network/canopy / CheckProtocolVersion

Method CheckProtocolVersion

fsm/automatic.go:111–127  ·  view source on GitHub ↗

CheckProtocolVersion() compares the protocol version against the governance enforced version

()

Source from the content-addressed store, hash-verified

109
110// CheckProtocolVersion() compares the protocol version against the governance enforced version
111func (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
130func (s *StateMachine) HandleCertificateResults(qc *lib.QuorumCertificate, committee *lib.ValidatorSet) lib.ErrorI {

Callers 2

BeginBlockMethod · 0.95
TestCheckProtocolVersionFunction · 0.80

Calls 4

GetParamsConsMethod · 0.95
HeightMethod · 0.95
ParseProtocolVersionMethod · 0.80

Tested by 1

TestCheckProtocolVersionFunction · 0.64