Adds a filter for multiple addressable kinds but one key

This commit is contained in:
Vitor Pamplona
2026-02-24 17:21:57 -05:00
parent 4e39df2707
commit 6c63ef60f3
@@ -67,6 +67,18 @@ fun LargeSoftCache<Address, AddressableNote>.filter(
consumer: CacheCollectors.BiFilter<Address, AddressableNote> = ACCEPT_ALL_FILTER,
): List<AddressableNote> = filter(kindStart(kind, pubKey), kindEnd(kind, pubKey), consumer)
fun LargeSoftCache<Address, AddressableNote>.filter(
kinds: List<Int>,
pubKey: HexKey,
consumer: CacheCollectors.BiFilter<Address, AddressableNote> = ACCEPT_ALL_FILTER,
): Set<AddressableNote> {
val set = mutableSetOf<AddressableNote>()
kinds.forEach {
set.addAll(filterIntoSet(kindStart(it, pubKey), kindEnd(it, pubKey), consumer))
}
return set
}
fun LargeSoftCache<Address, AddressableNote>.filterIntoSet(
kind: Int,
consumer: CacheCollectors.BiFilter<Address, AddressableNote> = ACCEPT_ALL_FILTER,