diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 87b13bab85..84cb9bd4ff 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -14,6 +14,7 @@ and this library adheres to Rust's notion of flag. - `zcash_client_backend::data_api`: - `AccountBalance::with_orchard_balance_mut` + - `AccountBirthday::orchard_frontier` - `BlockMetadata::orchard_tree_size` - `ScannedBlock::orchard` - `ScannedBlockCommitments::orchard` @@ -41,6 +42,7 @@ and this library adheres to Rust's notion of ### Changed - `zcash_client_backend::data_api`: + - Arguments to `AccountBirthday::from_parts` have changed. - Arguments to `BlockMetadata::from_parts` have changed. - Arguments to `ScannedBlock::from_parts` have changed. - Changes to the `WalletRead` trait: diff --git a/zcash_client_backend/src/data_api.rs b/zcash_client_backend/src/data_api.rs index eb39226f03..19e56110f6 100644 --- a/zcash_client_backend/src/data_api.rs +++ b/zcash_client_backend/src/data_api.rs @@ -961,6 +961,9 @@ impl SentTransactionOutput { pub struct AccountBirthday { height: BlockHeight, sapling_frontier: Frontier, + #[cfg(feature = "orchard")] + orchard_frontier: + Frontier, recover_until: Option, } @@ -1002,11 +1005,17 @@ impl AccountBirthday { pub fn from_parts( height: BlockHeight, sapling_frontier: Frontier, + #[cfg(feature = "orchard")] orchard_frontier: Frontier< + orchard::tree::MerkleHashOrchard, + { orchard::NOTE_COMMITMENT_TREE_DEPTH as u8 }, + >, recover_until: Option, ) -> Self { Self { height, sapling_frontier, + #[cfg(feature = "orchard")] + orchard_frontier, recover_until, } } @@ -1028,6 +1037,8 @@ impl AccountBirthday { Ok(Self { height: BlockHeight::try_from(treestate.height + 1)?, sapling_frontier: treestate.sapling_tree()?.to_frontier(), + #[cfg(feature = "orchard")] + orchard_frontier: treestate.orchard_tree()?.to_frontier(), recover_until, }) } @@ -1040,6 +1051,16 @@ impl AccountBirthday { &self.sapling_frontier } + /// Returns the Orchard note commitment tree frontier as of the end of the block at + /// [`Self::height`]. + #[cfg(feature = "orchard")] + pub fn orchard_frontier( + &self, + ) -> &Frontier + { + &self.orchard_frontier + } + /// Returns the birthday height of the account. pub fn height(&self) -> BlockHeight { self.height @@ -1065,6 +1086,8 @@ impl AccountBirthday { AccountBirthday::from_parts( params.activation_height(NetworkUpgrade::Sapling).unwrap(), Frontier::empty(), + #[cfg(feature = "orchard")] + Frontier::empty(), None, ) } diff --git a/zcash_client_sqlite/src/wallet/scanning.rs b/zcash_client_sqlite/src/wallet/scanning.rs index e676837459..e7341a3620 100644 --- a/zcash_client_sqlite/src/wallet/scanning.rs +++ b/zcash_client_sqlite/src/wallet/scanning.rs @@ -667,7 +667,13 @@ pub(crate) mod tests { vec![Node::empty_leaf(); frontier_position.past_ommer_count().into()], ) .unwrap(); - AccountBirthday::from_parts(birthday_height, frontier, None) + AccountBirthday::from_parts( + birthday_height, + frontier, + #[cfg(feature = "orchard")] + Frontier::empty(), + None, + ) }) .build(); @@ -717,7 +723,13 @@ pub(crate) mod tests { st.wallet_mut() .create_account( &SecretVec::new(vec![0; 32]), - AccountBirthday::from_parts(wallet_birthday, Frontier::empty(), None), + AccountBirthday::from_parts( + wallet_birthday, + Frontier::empty(), + #[cfg(feature = "orchard")] + Frontier::empty(), + None, + ), ) .unwrap();