consensus: handle encoding errors in Hash()
This commit is contained in:
parent
388fed06e5
commit
553b2391a3
1 changed files with 3 additions and 0 deletions
|
@ -241,6 +241,9 @@ func (p *Payload) DecodeBinaryUnsigned(r *io.BinReader) {
|
||||||
func (p *Payload) Hash() util.Uint256 {
|
func (p *Payload) Hash() util.Uint256 {
|
||||||
w := io.NewBufBinWriter()
|
w := io.NewBufBinWriter()
|
||||||
p.EncodeBinaryUnsigned(w.BinWriter)
|
p.EncodeBinaryUnsigned(w.BinWriter)
|
||||||
|
if w.Err != nil {
|
||||||
|
panic("failed to hash payload")
|
||||||
|
}
|
||||||
|
|
||||||
return hash.DoubleSha256(w.Bytes())
|
return hash.DoubleSha256(w.Bytes())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue