Patch for concurrent iterator & others (onto v1.11.6) #386

Closed
roysc wants to merge 1565 commits from v1.11.6-statediff-v5 into master
2 changed files with 14 additions and 1 deletions
Showing only changes of commit a182c76815 - Show all commits

View File

@ -710,7 +710,7 @@ func (c *Clique) APIs(chain consensus.ChainHeaderReader) []rpc.API {
func SealHash(header *types.Header) (hash common.Hash) { func SealHash(header *types.Header) (hash common.Hash) {
hasher := sha3.NewLegacyKeccak256() hasher := sha3.NewLegacyKeccak256()
encodeSigHeader(hasher, header) encodeSigHeader(hasher, header)
hasher.Sum(hash[:0]) hasher.(crypto.KeccakState).Read(hash[:])
return hash return hash
} }

View File

@ -112,3 +112,16 @@ func TestReimportMirroredState(t *testing.T) {
t.Fatalf("chain head mismatch: have %d, want %d", head, 3) t.Fatalf("chain head mismatch: have %d, want %d", head, 3)
} }
} }
func TestSealHash(t *testing.T) {
have := SealHash(&types.Header{
Difficulty: new(big.Int),
Number: new(big.Int),
Extra: make([]byte, 32+65),
BaseFee: new(big.Int),
})
want := common.HexToHash("0xbd3d1fa43fbc4c5bfcc91b179ec92e2861df3654de60468beb908ff805359e8f")
if have != want {
t.Errorf("have %x, want %x", have, want)
}
}