chain: move merkle_tree to block::merkle.

This Merkle tree is the SHA256d one used only for including transactions
in a block, so it should be kept there in order to not be confused with
other Merkle trees (like the note commitment trees).
This commit is contained in:
Henry de Valence 2020-08-15 20:57:59 -07:00
parent 7298e7c636
commit ce1e81b274
6 changed files with 5 additions and 7 deletions

View File

@ -10,6 +10,8 @@ mod height;
mod root_hash; mod root_hash;
mod serialize; mod serialize;
pub mod merkle;
#[cfg(test)] #[cfg(test)]
mod tests; mod tests;

View File

@ -1,10 +1,9 @@
use chrono::{DateTime, Duration, Utc}; use chrono::{DateTime, Duration, Utc};
use crate::merkle_tree::MerkleTreeRootHash;
use crate::serialization::ZcashSerialize; use crate::serialization::ZcashSerialize;
use crate::work::{difficulty::CompactDifficulty, equihash::Solution}; use crate::work::{difficulty::CompactDifficulty, equihash::Solution};
use super::{BlockHeaderHash, Error}; use super::{merkle::MerkleTreeRootHash, BlockHeaderHash, Error};
/// Block header. /// Block header.
/// ///

View File

@ -2,11 +2,11 @@ use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use chrono::{TimeZone, Utc}; use chrono::{TimeZone, Utc};
use std::io; use std::io;
use crate::merkle_tree::MerkleTreeRootHash;
use crate::serialization::ZcashDeserializeInto; use crate::serialization::ZcashDeserializeInto;
use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize}; use crate::serialization::{ReadZcashExt, SerializationError, ZcashDeserialize, ZcashSerialize};
use crate::work::{difficulty::CompactDifficulty, equihash}; use crate::work::{difficulty::CompactDifficulty, equihash};
use super::merkle::MerkleTreeRootHash;
use super::Block; use super::Block;
use super::BlockHeader; use super::BlockHeader;
use super::BlockHeaderHash; use super::BlockHeaderHash;

View File

@ -1,4 +1,3 @@
use crate::merkle_tree::MerkleTreeRootHash;
use crate::parameters::Network; use crate::parameters::Network;
use crate::work::{difficulty::CompactDifficulty, equihash}; use crate::work::{difficulty::CompactDifficulty, equihash};
@ -32,7 +31,7 @@ impl Arbitrary for BlockHeader {
// version is interpreted as i32 in the spec, so we are limited to i32::MAX here // version is interpreted as i32 in the spec, so we are limited to i32::MAX here
(4u32..(i32::MAX as u32)), (4u32..(i32::MAX as u32)),
any::<BlockHeaderHash>(), any::<BlockHeaderHash>(),
any::<MerkleTreeRootHash>(), any::<merkle::MerkleTreeRootHash>(),
any::<[u8; 32]>(), any::<[u8; 32]>(),
// time is interpreted as u32 in the spec, but rust timestamps are i64 // time is interpreted as u32 in the spec, but rust timestamps are i64
(0i64..(u32::MAX as i64)), (0i64..(u32::MAX as i64)),

View File

@ -11,8 +11,6 @@
#[macro_use] #[macro_use]
extern crate serde; extern crate serde;
mod merkle_tree;
pub mod amount; pub mod amount;
pub mod block; pub mod block;
pub mod parameters; pub mod parameters;