sdk: wot knows its size.

This commit is contained in:
fiatjaf 2025-04-04 14:32:08 -03:00
parent 4705719c76
commit 72eeabd2f4

View File

@ -149,13 +149,17 @@ func makeWoTFilter(m chan string) WotXorFilter {
} }
xf, _ := xorfilter.Populate(shids) xf, _ := xorfilter.Populate(shids)
return WotXorFilter{*xf} return WotXorFilter{len(shids), *xf}
} }
type WotXorFilter struct { type WotXorFilter struct {
Items int
xorfilter.Xor8 xorfilter.Xor8
} }
func (wxf WotXorFilter) Contains(pubkey string) bool { func (wxf WotXorFilter) Contains(pubkey string) bool {
if wxf.Items == 0 {
return false
}
return wxf.Xor8.Contains(PubKeyToShid(pubkey)) return wxf.Xor8.Contains(PubKeyToShid(pubkey))
} }