diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index 09cc70dc8..f4acf6ff8 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -291,8 +291,9 @@ and this library adheres to Rust's notion of `zcash_client_backend::proposal`). - `SentTransactionOutput::sapling_change_to` - the note created by an internal transfer is now conveyed in the `recipient` field. - - `WalletSaplingSpend` use the generic `WalletSpend` instead. - - `WalletSaplingOutput::cmu` obtain `cmu` from the `Note` instead. + - `WalletSaplingSpend` (use the generic `WalletSpend` instead). + - `WalletSaplingOutput::cmu` (use `WalletSaplingOutput::note` and + `sapling_crypto::Note::cmu` instead). - `zcash_client_backend::data_api`: - `{PoolType, ShieldedProtocol}` (moved to `zcash_client_backend`). - `{NoteId, Recipient}` (moved to `zcash_client_backend::wallet`). diff --git a/zcash_client_backend/src/proto.rs b/zcash_client_backend/src/proto.rs index 1ed156916..17aa8ef90 100644 --- a/zcash_client_backend/src/proto.rs +++ b/zcash_client_backend/src/proto.rs @@ -200,6 +200,11 @@ impl TryFrom<&compact_formats::CompactOrchardAction> for orchard::note_encryptio #[cfg(feature = "orchard")] impl compact_formats::CompactOrchardAction { + /// Returns the note commitment for the output of this action. + /// + /// A convenience method that parses [`CompactOrchardAction.cmx`]. + /// + /// [`CompactOrchardAction.cmx`]: #structfield.cmx pub fn cmx(&self) -> Result { Option::from(orchard::note::ExtractedNoteCommitment::from_bytes( &self.cmx[..].try_into().map_err(|_| ())?, @@ -207,16 +212,21 @@ impl compact_formats::CompactOrchardAction { .ok_or(()) } + /// Returns the nullifier for the spend of this action. + /// + /// A convenience method that parses [`CompactOrchardAction.nullifier`]. + /// + /// [`CompactOrchardAction.cmx`]: #structfield.nullifier pub fn nf(&self) -> Result { let nf_bytes: [u8; 32] = self.nullifier[..].try_into().map_err(|_| ())?; Option::from(orchard::note::Nullifier::from_bytes(&nf_bytes)).ok_or(()) } - /// Returns the ephemeral public key for this output. + /// Returns the ephemeral public key for the output of this action. /// - /// A convenience method that parses [`CompactOutput.epk`]. + /// A convenience method that parses [`CompactOrchardAction.ephemeral_key`]. /// - /// [`CompactOutput.epk`]: #structfield.epk + /// [`CompactOrchardAction.ephemeral_key`]: #structfield.ephemeral_key pub fn ephemeral_key(&self) -> Result { self.ephemeral_key[..] .try_into() diff --git a/zcash_client_backend/src/scanning.rs b/zcash_client_backend/src/scanning.rs index 1a331630c..b75e80a1b 100644 --- a/zcash_client_backend/src/scanning.rs +++ b/zcash_client_backend/src/scanning.rs @@ -913,8 +913,8 @@ pub(crate) fn scan_block_with_runners< )) } -// Check for spent notes. The comparison against known-unspent nullifiers is done -// in constant time. +/// Check for spent notes. The comparison against known-unspent nullifiers is done +/// in constant time. fn find_spent( spends: &[Spend], nullifiers: &[(AccountId, Nf)], diff --git a/zcash_client_backend/src/wallet.rs b/zcash_client_backend/src/wallet.rs index e6ffd4a02..329e49870 100644 --- a/zcash_client_backend/src/wallet.rs +++ b/zcash_client_backend/src/wallet.rs @@ -109,7 +109,7 @@ pub struct WalletTx { } impl WalletTx { - /// Constructs a new [`WalletTx`] from its constituent parts + /// Constructs a new [`WalletTx`] from its constituent parts. pub fn new( txid: TxId, block_index: usize, @@ -130,7 +130,7 @@ impl WalletTx { } } - /// Returns the [`TxId`] for the corresponding [`Transaction`] + /// Returns the [`TxId`] for the corresponding [`Transaction`]. /// /// [`Transaction`]: zcash_primitives::transaction::Transaction pub fn txid(&self) -> TxId { @@ -251,7 +251,7 @@ impl WalletSpend { } } -/// Returns source metadata for a given incoming viewing key. +/// Source metadata for a given incoming viewing key. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum KeySource { /// The ZIP 32 account identifier and key scope for the key, if the key was derived from the