From 5c2f69bd2cff98382b4b458462d488e1945f3f37 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 29 Jun 2020 14:05:10 +0300 Subject: [PATCH] consensus: take payload hash based on data Fix 857ced82. --- pkg/consensus/consensus.go | 1 + pkg/consensus/payload.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/consensus/consensus.go b/pkg/consensus/consensus.go index 07a9d822b..444548974 100644 --- a/pkg/consensus/consensus.go +++ b/pkg/consensus/consensus.go @@ -167,6 +167,7 @@ var ( func NewPayload(m netmode.Magic) *Payload { return &Payload{ network: m, + message: new(message), } } diff --git a/pkg/consensus/payload.go b/pkg/consensus/payload.go index 31cbaec88..80f56f0f7 100644 --- a/pkg/consensus/payload.go +++ b/pkg/consensus/payload.go @@ -171,7 +171,7 @@ func (p *Payload) EncodeBinaryUnsigned(w *io.BinWriter) { w.WriteU32LE(p.height) w.WriteU16LE(p.validatorIndex) - if p.message != nil { + if p.data == nil { ww := io.NewBufBinWriter() p.message.EncodeBinary(ww.BinWriter) p.data = ww.Bytes()