mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
Merge ef42a3dffd into cc2b39bbd1
This commit is contained in:
commit
92d2d6b802
1 changed files with 11 additions and 2 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue