From 50e5e6fe296eaa8debbdf638c862dee736f4cbe3 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Wed, 5 Aug 2020 17:08:24 +0300 Subject: [PATCH] consensus: create recovery message with state root Closes #1270 --- pkg/consensus/consensus.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 4a17d52fc..c221c98b6 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -148,7 +148,7 @@ func NewService(cfg Config) (Service, error) { dbft.WithNewChangeView(func() payload.ChangeView { return new(changeView) }), dbft.WithNewCommit(srv.newCommit), dbft.WithNewRecoveryRequest(func() payload.RecoveryRequest { return new(recoveryRequest) }), - dbft.WithNewRecoveryMessage(func() payload.RecoveryMessage { return new(recoveryMessage) }), + dbft.WithNewRecoveryMessage(srv.newRecoveryMessage), dbft.WithVerifyPrepareRequest(srv.verifyRequest), ) @@ -267,6 +267,10 @@ func (s *service) newCommit() payload.Commit { return c } +func (s *service) newRecoveryMessage() payload.RecoveryMessage { + return &recoveryMessage{stateRootEnabled: s.stateRootEnabled()} +} + func (s *service) validatePayload(p *Payload) bool { validators := s.getValidators() if int(p.validatorIndex) >= len(validators) {