diff options
Diffstat (limited to 'core/types/bloom9.go')
-rw-r--r-- | core/types/bloom9.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/types/bloom9.go b/core/types/bloom9.go index 60aacc301..bdc6e60e7 100644 --- a/core/types/bloom9.go +++ b/core/types/bloom9.go @@ -106,6 +106,20 @@ func LogsBloom(logs []*Log) *big.Int { return bin } +type BloomIndexList [3]uint + +// BloomIndexes returns the bloom filter bit indexes belonging to the given key +func BloomIndexes(b []byte) BloomIndexList { + b = crypto.Keccak256(b[:]) + + var r [3]uint + for i, _ := range r { + r[i] = (uint(b[i+i+1]) + (uint(b[i+i]) << 8)) & 2047 + } + + return r +} + func bloom9(b []byte) *big.Int { b = crypto.Keccak256(b[:]) |