From 1bb314f767785fe617c3c5efeca1a64127339506 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 4 Aug 2020 10:47:20 -0400 Subject: include extra block data into hash calculation --- core/types/block.go | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'core/types/block.go') diff --git a/core/types/block.go b/core/types/block.go index 6fa710a..b3dbcd3 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -85,6 +85,7 @@ type Header struct { Extra []byte `json:"extraData" gencodec:"required"` MixDigest common.Hash `json:"mixHash"` Nonce BlockNonce `json:"nonce"` + ExtDataHash common.Hash `json:"extDataHash" gencodec:"required"` } // field type overrides for gencodec @@ -288,12 +289,15 @@ func (b *Block) DecodeRLP(s *rlp.Stream) error { b.header, b.uncles, b.transactions = eb.Header, eb.Uncles, eb.Txs b.extdata = nil } + b.hash = atomic.Value{} b.size.Store(common.StorageSize(rlp.ListSize(size))) return nil } func (b *Block) SetExtraData(data []byte) { b.extdata = data + b.header.ExtDataHash = rlpHash(data) + b.hash = atomic.Value{} } func (b *Block) ExtraData() []byte { -- cgit v1.2.3