Skip to content

Commit

Permalink
zcash_{keys, client_backend}: Fix no-default-features build.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttycom committed Apr 12, 2024
1 parent b60600a commit f28aa6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zcash_client_backend/src/data_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ use {
zcash_primitives::{legacy::TransparentAddress, transaction::components::OutPoint},
};

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

pub mod chain;
Expand Down Expand Up @@ -1334,7 +1334,7 @@ impl AccountBirthday {
///
/// This API is intended primarily to be used in testing contexts; under normal circumstances,
/// [`AccountBirthday::from_treestate`] should be used instead.
#[cfg(feature = "test-dependencies")]
#[cfg(any(test, feature = "test-dependencies"))]
pub fn from_parts(prior_chain_state: ChainState, recover_until: Option<BlockHeight>) -> Self {
Self {
prior_chain_state,
Expand Down
4 changes: 4 additions & 0 deletions zcash_keys/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,14 @@ impl Receiver {
/// as bare Sapling addresses, and Transparent receivers will be rendered as taddrs.
pub fn to_zcash_address(&self, net: NetworkType) -> ZcashAddress {
match self {
#[cfg(feature = "orchard")]
Receiver::Orchard(addr) => {
let receiver = unified::Receiver::Orchard(addr.to_raw_address_bytes());
let ua = unified::Address::try_from_items(vec![receiver])
.expect("A unified address may contain a single Orchard receiver.");
ZcashAddress::from_unified(net, ua)
}
#[cfg(feature = "sapling")]
Receiver::Sapling(addr) => ZcashAddress::from_sapling(net, addr.to_bytes()),
Receiver::Transparent(TransparentAddress::PublicKeyHash(data)) => {
ZcashAddress::from_transparent_p2pkh(net, *data)
Expand All @@ -269,7 +271,9 @@ impl Receiver {

pub fn corresponds(&self, addr: &ZcashAddress) -> bool {
addr.matches_receiver(&match self {
#[cfg(feature = "orchard")]
Receiver::Orchard(addr) => unified::Receiver::Orchard(addr.to_raw_address_bytes()),
#[cfg(feature = "sapling")]
Receiver::Sapling(addr) => unified::Receiver::Sapling(addr.to_bytes()),
Receiver::Transparent(TransparentAddress::PublicKeyHash(data)) => {
unified::Receiver::P2pkh(*data)
Expand Down

0 comments on commit f28aa6b

Please sign in to comment.