Skip to main content

compact_block_filter_encoded

Function compact_block_filter_encoded 

Source
pub fn compact_block_filter_encoded(
    block_identity: Bytes32,
    additions: &[Coin],
    removals: &[Bytes32],
) -> Result<Vec<u8>, Error>
Expand description

BIP-158 encoded filter bytes (Golomb–Rice GCS) for block light-client filtering (HSH-006).

Element order: each Coin::puzzle_hash for additions in slice order, then each removal Bytes32 in removals slice order — matches crate::L2Block::all_additions / crate::L2Block::all_removals when those slices are built the same way (SPEC §3.6).

Wire: compact_block_filter_encoded is a thin wrapper assembling the [[u8;32]; n] table and calling the crate-internal bip158_filter_encoded helper. Commitment: compute_filter_hash is SHA-256 of the returned bytes (Chia std_hash(encoded) pattern).

Downstream: Light clients need these bytes (not only the hash) to run membership queries via bitcoin::bip158::BlockFilter.