Skip to main content

dig_clvm/consensus/
result.rs

1//! Validation result types.
2
3use chia_bls::Signature;
4use chia_consensus::owned_conditions::OwnedSpendBundleConditions;
5use chia_protocol::Coin;
6use clvmr::cost::Cost;
7
8/// Result of validating a spend bundle or block.
9///
10/// This is the primary output: the set of coin state changes that the caller
11/// commits to blockchain state.
12pub struct SpendResult {
13    /// Coins to add to the UTXO set (created by CREATE_COIN conditions).
14    pub additions: Vec<Coin>,
15    /// Coins to remove from the UTXO set (the spent coins).
16    pub removals: Vec<Coin>,
17    /// Total fee (sum of removals - sum of additions).
18    pub fee: u64,
19    /// Full parsed conditions from chia-consensus.
20    pub conditions: OwnedSpendBundleConditions,
21}
22
23/// Output of build_block_generator().
24pub struct BlockGeneratorResult {
25    /// The compressed block-level CLVM program.
26    pub generator: Vec<u8>,
27    /// Block heights of referenced previous generators.
28    pub block_refs: Vec<u32>,
29    /// Aggregated BLS signature across all included bundles.
30    pub aggregated_signature: Signature,
31    /// Coins created by all included spends.
32    pub additions: Vec<Coin>,
33    /// Coins spent by all included spends.
34    pub removals: Vec<Coin>,
35    /// Total CLVM cost of all included spends.
36    pub cost: Cost,
37    /// Number of bundles included.
38    pub bundles_included: usize,
39}