block: precompute ConsensusData hash on UnmarshalJSON

That's what we usually do for block or transaction hashes.
This commit is contained in:
Roman Khimov 2020-06-05 12:14:27 +03:00
parent dfc7a9bfd1
commit 6853470603

View file

@ -227,5 +227,8 @@ func (b *Block) UnmarshalJSON(data []byte) error {
b.Base = *base
b.Transactions = auxb.Transactions
b.ConsensusData = auxb.ConsensusData
// Some tests rely on hash presence and we're usually precomputing
// other hashes upon deserialization.
_ = b.ConsensusData.Hash()
return nil
}