Skip to content

Commit

Permalink
Merge pull request #1253 from zcash/more-orchard-tests
Browse files Browse the repository at this point in the history
zcash_client_sqlite: More Orchard tests
  • Loading branch information
nuttycom authored Mar 11, 2024
2 parents 1003cd6 + de58b5a commit cc3f05a
Show file tree
Hide file tree
Showing 5 changed files with 507 additions and 309 deletions.
29 changes: 22 additions & 7 deletions zcash_client_backend/src/data_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ use {
zcash_primitives::{legacy::TransparentAddress, transaction::components::OutPoint},
};

#[cfg(feature = "test-dependencies")]
use zcash_primitives::consensus::NetworkUpgrade;

pub mod chain;
pub mod error;
pub mod scanning;
Expand Down Expand Up @@ -1154,25 +1157,37 @@ impl AccountBirthday {
}

#[cfg(feature = "test-dependencies")]
/// Constructs a new [`AccountBirthday`] at Sapling activation, with no
/// "recover until" height.
/// Constructs a new [`AccountBirthday`] at the given network upgrade's activation,
/// with no "recover until" height.
///
/// # Panics
///
/// Panics if the Sapling activation height is not set.
pub fn from_sapling_activation<P: zcash_primitives::consensus::Parameters>(
/// Panics if the activation height for the given network upgrade is not set.
pub fn from_activation<P: zcash_primitives::consensus::Parameters>(
params: &P,
network_upgrade: NetworkUpgrade,
) -> AccountBirthday {
use zcash_primitives::consensus::NetworkUpgrade;

AccountBirthday::from_parts(
params.activation_height(NetworkUpgrade::Sapling).unwrap(),
params.activation_height(network_upgrade).unwrap(),
Frontier::empty(),
#[cfg(feature = "orchard")]
Frontier::empty(),
None,
)
}

#[cfg(feature = "test-dependencies")]
/// Constructs a new [`AccountBirthday`] at Sapling activation, with no
/// "recover until" height.
///
/// # Panics
///
/// Panics if the Sapling activation height is not set.
pub fn from_sapling_activation<P: zcash_primitives::consensus::Parameters>(
params: &P,
) -> AccountBirthday {
Self::from_activation(params, NetworkUpgrade::Sapling)
}
}

/// This trait encapsulates the write capabilities required to update stored
Expand Down
Loading

0 comments on commit cc3f05a

Please sign in to comment.