mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-05 03:58:23 +00:00
consensus: use a method function for NewPayload()
This commit is contained in:
parent
3a6186af54
commit
2863343f03
1 changed files with 7 additions and 1 deletions
|
@ -138,7 +138,7 @@ func NewService(cfg Config) (Service, error) {
|
|||
dbft.WithGetValidators(srv.getValidators),
|
||||
dbft.WithGetConsensusAddress(srv.getConsensusAddress),
|
||||
|
||||
dbft.WithNewConsensusPayload(func() payload.ConsensusPayload { p := new(Payload); p.message = &message{}; return p }),
|
||||
dbft.WithNewConsensusPayload(srv.newPayload),
|
||||
dbft.WithNewPrepareRequest(srv.newPrepareRequest),
|
||||
dbft.WithNewPrepareResponse(func() payload.PrepareResponse { return new(prepareResponse) }),
|
||||
dbft.WithNewChangeView(func() payload.ChangeView { return new(changeView) }),
|
||||
|
@ -214,6 +214,12 @@ func (s *service) eventLoop() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *service) newPayload() payload.ConsensusPayload {
|
||||
return &Payload{
|
||||
message: new(message),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *service) newPrepareRequest() payload.PrepareRequest {
|
||||
sr, err := s.Chain.GetStateRoot(s.Chain.BlockHeight())
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue