zebra_state::service::check::nullifier

Function remove_from_non_finalized_chain

source
pub(crate) fn remove_from_non_finalized_chain<'block, NullifierT>(
    chain_nullifiers: &mut HashSet<NullifierT>,
    shielded_data_nullifiers: impl IntoIterator<Item = &'block NullifierT>,
)
where NullifierT: Debug + Eq + Hash + 'block,
Expand description

Remove nullifiers that were previously added to this non-finalized Chain by this shielded data.

“A note can change from being unspent to spent as a node’s view of the best valid block chain is extended by new transactions.

Also, block chain reorganizations can cause a node to switch to a different best valid block chain that does not contain the transaction in which a note was output“

https://zips.z.cash/protocol/nu5.pdf#decryptivk

Note: reorganizations can also change the best chain to one where a note was unspent, rather than spent.

§Panics

Panics if any nullifier is missing from the chain when we try to remove it.

Blocks with duplicate nullifiers are rejected by add_to_non_finalized_chain_unique, so this shielded data should be the only shielded data that added this nullifier to this Chain.