consensus: set preparation hash in recovery message

This commit is contained in:
Evgenii Stratonikov 2019-12-02 16:18:54 +03:00
parent 7c900edd2d
commit b649ffb88e

View file

@ -136,11 +136,18 @@ func (m *recoveryMessage) AddPayload(p payload.ConsensusPayload) {
switch p.Type() {
case payload.PrepareRequestType:
m.prepareRequest = p.GetPrepareRequest().(*prepareRequest)
h := p.Hash()
m.preparationHash = &h
case payload.PrepareResponseType:
m.preparationPayloads = append(m.preparationPayloads, &preparationCompact{
ValidatorIndex: p.ValidatorIndex(),
InvocationScript: p.(*Payload).Witness.InvocationScript,
})
if m.preparationHash == nil {
h := p.GetPrepareResponse().PreparationHash()
m.preparationHash = &h
}
case payload.ChangeViewType:
m.changeViewPayloads = append(m.changeViewPayloads, &changeViewCompact{
ValidatorIndex: p.ValidatorIndex(),