// Package filter implements BIP158 basic compact block filters: Golomb-coded // sets (GCS) over the outputs of SipHash-2-4. // // A filter is built from an element set and the hash of the block it commits // to. The first 16 bytes of the block hash, in the internal (little-endian) // byte order used by the Bitcoin wire protocol, are used as the SipHash key. // The basic filter type uses M = 784931 and P = 19, giving a false positive // rate of about 1/784931 per queried element. // // The BIP158 basic element set consists of the previous output scripts spent // by non-coinbase inputs, plus every output scriptPubKey in the block except // OP_RETURN scripts. Empty ("nil") elements must be omitted and the element // set is a set: exact duplicate scripts are included only once. Build does not // enforce those rules; callers that supply the element set must. BuildFromScripts // drops empty and duplicate scripts, but leaves OP_RETURN filtering to the // caller. // // The serialization is a CompactSize element count followed by the bit-packed // Golomb-Rice coded deltas of the sorted, hashed values, zero-padded to a byte // boundary. A filter over the empty set is exactly the single byte 0x00. package filter