mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-25 13:56:35 +00:00
block: precompute ConsensusData hash on UnmarshalJSON
That's what we usually do for block or transaction hashes.
This commit is contained in:
parent
dfc7a9bfd1
commit
6853470603
1 changed files with 3 additions and 0 deletions
|
@ -227,5 +227,8 @@ func (b *Block) UnmarshalJSON(data []byte) error {
|
||||||
b.Base = *base
|
b.Base = *base
|
||||||
b.Transactions = auxb.Transactions
|
b.Transactions = auxb.Transactions
|
||||||
b.ConsensusData = auxb.ConsensusData
|
b.ConsensusData = auxb.ConsensusData
|
||||||
|
// Some tests rely on hash presence and we're usually precomputing
|
||||||
|
// other hashes upon deserialization.
|
||||||
|
_ = b.ConsensusData.Hash()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue