Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: str4d <[email protected]>
  • Loading branch information
nuttycom and str4d authored Aug 7, 2023
1 parent ef0b27c commit 47ac5cb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion zcash_client_backend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ and this library adheres to Rust's notion of
- `WalletRead::TxRef` has been removed in favor of consistently using `TxId` instead.
- `WalletRead::get_transaction` now takes a `TxId` as its argument.
- `WalletWrite::{store_decrypted_tx, store_sent_tx}` now return `Result<(), Self::Error>`
as the `WalletRead::TxRef` associated type has been removed. Use `TxId` instead.
as the `WalletRead::TxRef` associated type has been removed. Use
`WalletRead::get_transaction` with the transaction's `TxId` instead.
- `WalletRead::get_memo` now takes a `NoteId` as its argument instead of `Self::NoteRef`
and returns `Result<Option<Memo>, Self::Error>` instead of `Result<Memo,
Self::Error>` in order to make representable wallet states where the full
Expand Down
11 changes: 8 additions & 3 deletions zcash_client_backend/src/data_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,27 +386,32 @@ pub enum ShieldedProtocol {
pub struct NoteId {
txid: TxId,
protocol: ShieldedProtocol,
output_index: u32,
output_index: u16,
}

impl NoteId {
pub fn new(txid: TxId, protocol: ShieldedProtocol, output_index: u32) -> Self {
/// Constructs a new `NoteId` from its parts.
pub fn new(txid: TxId, protocol: ShieldedProtocol, output_index: u16) -> Self {
Self {
txid,
protocol,
output_index,
}
}

/// Returns the ID of the transaction containing this note.
pub fn txid(&self) -> &TxId {
&self.txid
}

/// Returns the shielded protocol used by this note.
pub fn protocol(&self) -> ShieldedProtocol {
self.protocol
}

pub fn output_index(&self) -> u32 {
/// Returns the index of this note within its transaction's corresponding list of
/// shielded outputs.
pub fn output_index(&self) -> u16 {
self.output_index
}
}
Expand Down

0 comments on commit 47ac5cb

Please sign in to comment.