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 committed Aug 7, 2023
1 parent d3b7dff commit f602ec1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 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
2 changes: 1 addition & 1 deletion zcash_client_sqlite/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ pub(crate) fn get_received_memo(
.transpose()
}

/// Looks up a transaction by its internal database identifier.
/// Looks up a transaction by its [`TxId`].
///
/// Returns the decoded transaction, along with the block height that was used in its decoding.
/// This is either the block height at which the transaction was mined, or the expiry height if the
Expand Down

0 comments on commit f602ec1

Please sign in to comment.