core/state/pruner: better comments

This commit is contained in:
Marius van der Wijden 2024-01-22 13:28:24 +01:00
parent c09e4c5699
commit 60fcfbd875
2 changed files with 4 additions and 6 deletions

View file

@ -27,9 +27,7 @@ import (
bloomfilter "github.com/holiman/bloomfilter/v2" bloomfilter "github.com/holiman/bloomfilter/v2"
) )
// stateBloomHasher is a wrapper around a byte blob to satisfy the interface API // stateBloomHasher is used to convert a trie hash or contract code hash into a 64 bit mini hash.
// requirements of the bloom library used. It's used to convert a trie hash or
// contract code hash into a 64 bit mini hash.
func stateBloomHasher(f []byte) uint64 { func stateBloomHasher(f []byte) uint64 {
return binary.BigEndian.Uint64(f) return binary.BigEndian.Uint64(f)
} }

View file

@ -124,17 +124,17 @@ type diffLayer struct {
lock sync.RWMutex lock sync.RWMutex
} }
// destructBloomHasher is used to convert a destruct event into a 64 bit mini hash.
func destructBloomHasher(h common.Hash) uint64 { func destructBloomHasher(h common.Hash) uint64 {
return binary.BigEndian.Uint64(h[bloomDestructHasherOffset : bloomDestructHasherOffset+8]) return binary.BigEndian.Uint64(h[bloomDestructHasherOffset : bloomDestructHasherOffset+8])
} }
// accountBloomHasher is a wrapper around a common.Hash to satisfy the interface // accountBloomHasher is used to convert an account hash into a 64 bit mini hash.
// API requirements of the bloom library used. It's used to convert an account
// hash into a 64 bit mini hash.
func accountBloomHasher(h common.Hash) uint64 { func accountBloomHasher(h common.Hash) uint64 {
return binary.BigEndian.Uint64(h[bloomAccountHasherOffset : bloomAccountHasherOffset+8]) return binary.BigEndian.Uint64(h[bloomAccountHasherOffset : bloomAccountHasherOffset+8])
} }
// storageBloomHasher is used to convert an account hash and a storage hash into a 64 bit mini hash.
func storageBloomHasher(h0, h1 common.Hash) uint64 { func storageBloomHasher(h0, h1 common.Hash) uint64 {
return binary.BigEndian.Uint64(h0[bloomStorageHasherOffset:bloomStorageHasherOffset+8]) ^ return binary.BigEndian.Uint64(h0[bloomStorageHasherOffset:bloomStorageHasherOffset+8]) ^
binary.BigEndian.Uint64(h1[bloomStorageHasherOffset:bloomStorageHasherOffset+8]) binary.BigEndian.Uint64(h1[bloomStorageHasherOffset:bloomStorageHasherOffset+8])