consensus: take payload hash based on data

Fix 857ced82.
This commit is contained in:
Evgenii Stratonikov 2020-06-29 14:05:10 +03:00
parent 8ad355b444
commit 5c2f69bd2c
2 changed files with 2 additions and 1 deletions

View file

@ -167,6 +167,7 @@ var (
func NewPayload(m netmode.Magic) *Payload { func NewPayload(m netmode.Magic) *Payload {
return &Payload{ return &Payload{
network: m, network: m,
message: new(message),
} }
} }

View file

@ -171,7 +171,7 @@ func (p *Payload) EncodeBinaryUnsigned(w *io.BinWriter) {
w.WriteU32LE(p.height) w.WriteU32LE(p.height)
w.WriteU16LE(p.validatorIndex) w.WriteU16LE(p.validatorIndex)
if p.message != nil { if p.data == nil {
ww := io.NewBufBinWriter() ww := io.NewBufBinWriter()
p.message.EncodeBinary(ww.BinWriter) p.message.EncodeBinary(ww.BinWriter)
p.data = ww.Bytes() p.data = ww.Bytes()