Skip to main content

compute_removals_root

Function compute_removals_root 

Source
pub fn compute_removals_root(removals: &[Bytes32]) -> Bytes32
Expand description

removals_root (header field, SPEC §3.5) — Merkle-set root over all spent coin IDs in the block.

Normative: HSH-005 and Chia block_body_validation (~185, removal coin name set).
Algorithm: Empty slice → EMPTY_ROOT. Otherwise each Bytes32 removal ID is one leaf in the radix Merkle set (chia_consensus::merkle_set::compute_merkle_set_root). Unlike compute_additions_root, there is no grouping: each spent coin ID is inserted directly.

Order: chia_consensus::merkle_set::compute_merkle_set_root defines a set hash: the same multiset of IDs yields the same root regardless of slice order (validated in tests/test_hsh_005_removals_root.rs).

Callers: crate::L2Block::compute_removals_root delegates here using crate::L2Block::all_removals order as the canonical body walk; permuting the input slice must not change the root when the set of IDs is unchanged.