createBloomFilter

abstract fun createBloomFilter(items: Array<Any>, falsePosRate: Double, capacity: Int, maxSize: Int, flags: Int = 0, tweak: Int = 1): ByteArray

Given an array of items, creates a bloom filter and returns it serialized. Typical items are addresses (just the raw 20 bytes), transaction hashes, and outpoints

Return

Bloom filter serialized as in the P2P network format

Parameters

items

Array of bitstrings to place into the bloom filter

falsePosRate

Desired Bloom false positive rate

capacity

Number of elements that can be placed into this bloom while maintaining the falsePosRate. If this is < items.count(), items.count() is used. The reason to provide a larger capacity is to allow items to be added into the bloom filter later

maxSize

Maximum size of the bloom filter -- if the capacity and falsePosRate result in a bloom that's larger than this, this size is used instead

flags

See @BloomFlags for possible fields

tweak

Change tweak to create a different bloom filter. Used to ensure that collision attacks only work against one filter or node