diff options
author | Determinant <[email protected]> | 2020-08-04 10:47:20 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2020-08-04 10:47:20 -0400 |
commit | 1bb314f767785fe617c3c5efeca1a64127339506 (patch) | |
tree | 1b86c0dab079115e811512bd979de53a5137add4 /core | |
parent | 232173cbd4669223c7541fcb1d5ec77befaf2fdc (diff) |
include extra block data into hash calculation
Diffstat (limited to 'core')
-rw-r--r-- | core/types/block.go | 4 |
1 files changed, 4 insertions, 0 deletions
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 { |