Merge pull request #1272 from nspcc-dev/consensus/fix

consensus: create recovery message with state root
This commit is contained in:
Roman Khimov 2020-08-06 15:16:34 +03:00 committed by GitHub
commit edeb9a3d2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -148,7 +148,7 @@ func NewService(cfg Config) (Service, error) {
dbft.WithNewChangeView(func() payload.ChangeView { return new(changeView) }), dbft.WithNewChangeView(func() payload.ChangeView { return new(changeView) }),
dbft.WithNewCommit(srv.newCommit), dbft.WithNewCommit(srv.newCommit),
dbft.WithNewRecoveryRequest(func() payload.RecoveryRequest { return new(recoveryRequest) }), dbft.WithNewRecoveryRequest(func() payload.RecoveryRequest { return new(recoveryRequest) }),
dbft.WithNewRecoveryMessage(func() payload.RecoveryMessage { return new(recoveryMessage) }), dbft.WithNewRecoveryMessage(srv.newRecoveryMessage),
dbft.WithVerifyPrepareRequest(srv.verifyRequest), dbft.WithVerifyPrepareRequest(srv.verifyRequest),
) )
@ -267,6 +267,10 @@ func (s *service) newCommit() payload.Commit {
return c return c
} }
func (s *service) newRecoveryMessage() payload.RecoveryMessage {
return &recoveryMessage{stateRootEnabled: s.stateRootEnabled()}
}
func (s *service) validatePayload(p *Payload) bool { func (s *service) validatePayload(p *Payload) bool {
validators := s.getValidators() validators := s.getValidators()
if int(p.validatorIndex) >= len(validators) { if int(p.validatorIndex) >= len(validators) {