consensus: handle encoding errors in Hash()

This commit is contained in:
Roman Khimov 2020-01-30 15:51:49 +03:00
parent 388fed06e5
commit 553b2391a3

View file

@ -241,6 +241,9 @@ func (p *Payload) DecodeBinaryUnsigned(r *io.BinReader) {
func (p *Payload) Hash() util.Uint256 {
w := io.NewBufBinWriter()
p.EncodeBinaryUnsigned(w.BinWriter)
if w.Err != nil {
panic("failed to hash payload")
}
return hash.DoubleSha256(w.Bytes())
}