zebra_state::service::check::utxo

Function transparent_spend

source
pub fn transparent_spend(
    semantically_verified: &SemanticallyVerifiedBlock,
    non_finalized_chain_unspent_utxos: &HashMap<OutPoint, OrderedUtxo>,
    non_finalized_chain_spent_utxos: &HashSet<OutPoint>,
    finalized_state: &ZebraDb,
) -> Result<HashMap<OutPoint, OrderedUtxo>, ValidateContextError>
Expand description

Lookup all the transparent::Utxos spent by a SemanticallyVerifiedBlock. If any of the spends are invalid, return an error. Otherwise, return the looked up UTXOs.

Checks for the following kinds of invalid spends:

Double-spends:

  • duplicate spends that are both in this block,
  • spends of an output that was spent by a previous block,

Missing spends:

  • spends of an output that hasn’t been created yet, (in linear chain and transaction order),
  • spends of UTXOs that were never created in this chain,

Invalid spends:

  • spends of an immature transparent coinbase output,
  • unshielded spends of a transparent coinbase output.