whisper: minor refactoring

This commit is contained in:
Vlad 2018-01-07 21:12:05 +02:00 committed by Guillaume Ballet
parent b493e462aa
commit 90cf7a1727
2 changed files with 10 additions and 0 deletions

View file

@ -51,6 +51,7 @@ type Envelope struct {
// size returns the size of envelope as it is sent (i.e. public fields only) // size returns the size of envelope as it is sent (i.e. public fields only)
func (e *Envelope) size() int { func (e *Envelope) size() int {
const EnvelopeHeaderLength = 20
return EnvelopeHeaderLength + len(e.Data) return EnvelopeHeaderLength + len(e.Data)
} }

View file

@ -1067,3 +1067,12 @@ func addBloom(a, b []byte) []byte {
} }
return c return c
} }
func isBloomFilterEqual(a, b []byte) bool {
for i := 0; i < bloomFilterSize; i++ {
if a[i] != b[i] {
return false
}
}
return true
}