mirror of
https://github.com/status-im/status-go.git
synced 2025-01-18 02:31:47 +00:00
ca92f67014
This is to free the `waku` namespace for interfaces and types that will be moved from `eth-node`.
38 lines
546 B
Go
38 lines
546 B
Go
package common
|
|
|
|
func IsFullNode(bloom []byte) bool {
|
|
if bloom == nil {
|
|
return true
|
|
}
|
|
for _, b := range bloom {
|
|
if b != 255 {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
|
|
func BloomFilterMatch(filter, sample []byte) bool {
|
|
if filter == nil {
|
|
return true
|
|
}
|
|
|
|
for i := 0; i < BloomFilterSize; i++ {
|
|
f := filter[i]
|
|
s := sample[i]
|
|
if (f | s) != f {
|
|
return false
|
|
}
|
|
}
|
|
|
|
return true
|
|
}
|
|
|
|
func MakeFullNodeBloom() []byte {
|
|
bloom := make([]byte, BloomFilterSize)
|
|
for i := 0; i < BloomFilterSize; i++ {
|
|
bloom[i] = 0xFF
|
|
}
|
|
return bloom
|
|
}
|