From 6853470603afab30ace9d0f5de4cb4e0a9e052b3 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 5 Jun 2020 12:14:27 +0300 Subject: [PATCH] block: precompute ConsensusData hash on UnmarshalJSON That's what we usually do for block or transaction hashes. --- pkg/core/block/block.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/core/block/block.go b/pkg/core/block/block.go index 14c39ce51..cee27d060 100644 --- a/pkg/core/block/block.go +++ b/pkg/core/block/block.go @@ -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 }