This commit is contained in:
needkane 2018-09-03 15:13:05 +00:00 committed by GitHub
commit 92d2d6b802
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,7 +110,16 @@ func (h *Header) Size() common.StorageSize {
func rlpHash(x interface{}) (h common.Hash) { func rlpHash(x interface{}) (h common.Hash) {
hw := sha3.NewKeccak256() hw := sha3.NewKeccak256()
rlp.Encode(hw, x) err := rlp.Encode(hw, x)
if err != nil {
panic("encode error: " + err.Error())
}
hw.Sum(h[:0])
return h
}
func hash(x interface{}) (h common.Hash) {
hw := sha3.NewKeccak256()
hw.Sum(h[:0]) hw.Sum(h[:0])
return h return h
} }
@ -325,7 +334,7 @@ func (c *writeCounter) Write(b []byte) (int, error) {
} }
func CalcUncleHash(uncles []*Header) common.Hash { func CalcUncleHash(uncles []*Header) common.Hash {
return rlpHash(uncles) return hash(uncles)
} }
// WithSeal returns a new block with the data from b but the header replaced with // WithSeal returns a new block with the data from b but the header replaced with