ShortId

Short id for identifying inputs/outputs/kernels

可根据 hash 和 nonce 生成。

BlockSums

/// The output_sum and kernel_sum for a given block.
/// This is used to validate the next block being processed by applying
/// the inputs, outputs, kernels and kernel_offset from the new block
/// and checking everything sums correctly.
#[derive(Debug, Clone)]
pub struct BlockSums {
    /// The total output sum so far.
    pub output_sum: Commitment,
    /// The total kernel sum so far.
    pub kernel_sum: Commitment,
}

其作用在上面注释已经说清楚。

要保存到数据库?

Save blocks sums (the output_sum and kernel_sum) for the given block header.

  • save_block_sums
  • get_block_sums

会存储到数据,标识为 BLOCK_SUMS_PREFIX

主要用于区块验证、交易验证。

Verify the sum of the kernel excesses equals the sum of the outputs, taking into account both the kernel_offset and overage.

TxHashSetRoots

A helper to hold the roots of the txhashset in order to keep them readable

Hash

/// A hash to uniquely (or close enough) identify one of the main blockchain
/// constructs. Used pervasively for blocks, transactions and outputs.
pub struct Hash(pub [u8; 32]);

LruVerifierCache

/// An implementation of verifier_cache using lru_cache.
/// Caches tx kernels by kernel hash.
/// Caches outputs by output rangeproof hash (rangeproofs are committed to separately).
pub struct LruVerifierCache {
    kernel_sig_verification_cache: LruCache<Hash, bool>,
    rangeproof_verification_cache: LruCache<Hash, bool>,
}

区块的创建

交易的创建

区块的验证

交易的验证

results matching ""

    No results matching ""