mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
core/types: update requests hash
This commit is contained in:
parent
ca1ed7689f
commit
e9cf6255cb
1 changed files with 5 additions and 3 deletions
|
|
@ -18,6 +18,7 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/sha256"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -475,10 +476,11 @@ func CalcUncleHash(uncles []*Header) common.Hash {
|
||||||
}
|
}
|
||||||
|
|
||||||
func CalcRequestsHash(requests [][]byte) common.Hash {
|
func CalcRequestsHash(requests [][]byte) common.Hash {
|
||||||
if len(requests) == 0 {
|
h := sha256.New()
|
||||||
return EmptyRequestsHash
|
for _, item := range requests {
|
||||||
|
h.Write(item)
|
||||||
}
|
}
|
||||||
return rlpHash(requests)
|
return common.Hash(h.Sum(nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBlockWithHeader creates a block with the given header data. The
|
// NewBlockWithHeader creates a block with the given header data. The
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue