eth: opt incHash

This commit is contained in:
cuiweixie 2025-09-26 12:50:36 +08:00
parent 0977a02ec1
commit f699ad95aa
No known key found for this signature in database
GPG key ID: 16DF64EE15E495A3

View file

@ -74,8 +74,11 @@ func (r *hashRange) End() common.Hash {
// incHash returns the next hash, in lexicographical order (a.k.a plus one) // incHash returns the next hash, in lexicographical order (a.k.a plus one)
func incHash(h common.Hash) common.Hash { func incHash(h common.Hash) common.Hash {
var a uint256.Int for i := len(h) - 1; i >= 0; i-- {
a.SetBytes32(h[:]) h[i]++
a.AddUint64(&a, 1) if h[i] != 0 {
return common.Hash(a.Bytes32()) break
}
}
return h
} }