zakura-rpc 2.0.0

The Zakura node's JSON Remote Procedure Call (JSON-RPC) interface. Internal crate, published to support cargo install zakura
Documentation
//! Utility functions for RPC method tests.

use std::sync::Arc;
use zakura_chain::{
    block::Block,
    history_tree::{HistoryTree, NonEmptyHistoryTree},
    parameters::Network,
    sapling::tree::Root,
    serialization::ZcashDeserialize,
};

/// Create a history tree with one single block for a network by using Zebra test vectors.
pub fn fake_history_tree(network: &Network) -> Arc<HistoryTree> {
    let (block, sapling_root) = network.test_block_sapling_roots(1046400, 1116000).unwrap();

    let block = Arc::<Block>::zcash_deserialize(block).expect("block should deserialize");
    let first_sapling_root = Root::try_from(sapling_root).unwrap();

    let history_tree = NonEmptyHistoryTree::from_block(
        &Network::Mainnet,
        block,
        &first_sapling_root,
        &Default::default(),
        &Default::default(),
    )
    .unwrap();

    Arc::new(HistoryTree::from(history_tree))
}