Merge pull request #1129 from nspcc-dev/fix/payload

consensus: take payload hash based on data
This commit is contained in:
Roman Khimov 2020-06-29 16:05:02 +03:00 committed by GitHub
commit 8065114da6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View file

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

View file

@ -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()