Skip to main content

compute_filter_hash

Function compute_filter_hash 

Source
pub fn compute_filter_hash(
    block_identity: Bytes32,
    additions: &[Coin],
    removals: &[Bytes32],
) -> Bytes32
Expand description

filter_hash (header field, SPEC §3.6) — SHA-256 over BIP-158 compact filter bytes.

Normative: HSH-006.
Algorithm: compact_block_filter_encoded then Sha256 over the wire (empty IO error → hash of empty encoding, matching previous crate::L2Block::compute_filter_hash behavior via unwrap_or_default()).

SipHash keys: First 8 + next 8 bytes (LE u64) of block_identity — same as the crate-internal bip158_filter_encoded helper / Bitcoin GcsFilterWriter initialization used in this crate.

Callers: crate::L2Block::compute_filter_hash passes crate::L2BlockHeader::parent_hash as block_identity (SPEC §6.4; avoids circular dependence on the committed filter_hash inside L2Block::hash).