Merge pull request #1090 from nuttycom/rename_wallet_note
zcash_client_backend: rename `WalletNote` to `Note`
This commit is contained in:
commit
0548b3dd9b
|
@ -29,7 +29,7 @@ and this library adheres to Rust's notion of
|
|||
functionality and move it behind the `transparent-inputs` feature flag.
|
||||
- `zcash_client_backend::fees::{standard, sapling}`
|
||||
- `zcash_client_backend::wallet`:
|
||||
- `WalletNote`
|
||||
- `Note`
|
||||
- `ReceivedNote`
|
||||
- `WalletSaplingOutput::recipient_key_scope`
|
||||
- `zcash_client_backend::zip321::TransactionRequest::total`
|
||||
|
|
|
@ -26,7 +26,7 @@ use crate::{
|
|||
decrypt_transaction,
|
||||
fees::{self, ChangeValue, DustOutputPolicy},
|
||||
keys::UnifiedSpendingKey,
|
||||
wallet::{OvkPolicy, Recipient, WalletNote},
|
||||
wallet::{Note, OvkPolicy, Recipient},
|
||||
zip321::{self, Payment},
|
||||
PoolType, ShieldedProtocol,
|
||||
};
|
||||
|
@ -586,7 +586,7 @@ where
|
|||
.iter()
|
||||
.map(|selected| {
|
||||
match selected.note() {
|
||||
WalletNote::Sapling(note) => {
|
||||
Note::Sapling(note) => {
|
||||
let key = match selected.spending_key_scope() {
|
||||
Scope::External => usk.sapling().clone(),
|
||||
Scope::Internal => usk.sapling().derive_internal(),
|
||||
|
@ -600,7 +600,7 @@ where
|
|||
Ok((key, note, merkle_path))
|
||||
}
|
||||
#[cfg(feature = "orchard")]
|
||||
WalletNote::Orchard(_) => {
|
||||
Note::Orchard(_) => {
|
||||
// FIXME: Implement this once `Proposal` has been refactored to
|
||||
// include Orchard notes.
|
||||
panic!("Orchard spends are not yet supported");
|
||||
|
|
|
@ -237,20 +237,20 @@ impl<N, S> WalletSaplingOutput<N, S> {
|
|||
|
||||
/// An enumeration of supported shielded note types for use in [`ReceivedNote`]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum WalletNote {
|
||||
pub enum Note {
|
||||
Sapling(sapling::Note),
|
||||
#[cfg(feature = "orchard")]
|
||||
Orchard(orchard::Note),
|
||||
}
|
||||
|
||||
impl WalletNote {
|
||||
impl Note {
|
||||
pub fn value(&self) -> NonNegativeAmount {
|
||||
match self {
|
||||
WalletNote::Sapling(n) => n.value().try_into().expect(
|
||||
Note::Sapling(n) => n.value().try_into().expect(
|
||||
"Sapling notes must have values in the range of valid non-negative ZEC values.",
|
||||
),
|
||||
#[cfg(feature = "orchard")]
|
||||
WalletNote::Orchard(n) => NonNegativeAmount::from_u64(n.value().inner()).expect(
|
||||
Note::Orchard(n) => NonNegativeAmount::from_u64(n.value().inner()).expect(
|
||||
"Orchard notes must have values in the range of valid non-negative ZEC values.",
|
||||
),
|
||||
}
|
||||
|
@ -264,7 +264,7 @@ pub struct ReceivedNote<NoteRef> {
|
|||
note_id: NoteRef,
|
||||
txid: TxId,
|
||||
output_index: u16,
|
||||
note: WalletNote,
|
||||
note: Note,
|
||||
spending_key_scope: Scope,
|
||||
note_commitment_tree_position: Position,
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ impl<NoteRef> ReceivedNote<NoteRef> {
|
|||
note_id: NoteRef,
|
||||
txid: TxId,
|
||||
output_index: u16,
|
||||
note: WalletNote,
|
||||
note: Note,
|
||||
spending_key_scope: Scope,
|
||||
note_commitment_tree_position: Position,
|
||||
) -> Self {
|
||||
|
@ -297,7 +297,7 @@ impl<NoteRef> ReceivedNote<NoteRef> {
|
|||
pub fn output_index(&self) -> u16 {
|
||||
self.output_index
|
||||
}
|
||||
pub fn note(&self) -> &WalletNote {
|
||||
pub fn note(&self) -> &Note {
|
||||
&self.note
|
||||
}
|
||||
pub fn value(&self) -> NonNegativeAmount {
|
||||
|
|
|
@ -5,7 +5,7 @@ use incrementalmerkletree::Position;
|
|||
use rusqlite::{named_params, params, types::Value, Connection, Row};
|
||||
use std::rc::Rc;
|
||||
|
||||
use sapling::{Diversifier, Note, Nullifier, Rseed};
|
||||
use sapling::{self, Diversifier, Nullifier, Rseed};
|
||||
use zcash_primitives::{
|
||||
consensus::{self, BlockHeight},
|
||||
memo::MemoBytes,
|
||||
|
@ -18,7 +18,7 @@ use zcash_primitives::{
|
|||
|
||||
use zcash_client_backend::{
|
||||
keys::UnifiedFullViewingKey,
|
||||
wallet::{ReceivedNote, WalletNote, WalletSaplingOutput},
|
||||
wallet::{Note, ReceivedNote, WalletSaplingOutput},
|
||||
DecryptedOutput, TransferType,
|
||||
};
|
||||
|
||||
|
@ -30,7 +30,7 @@ use super::{memo_repr, parse_scope, scope_code, wallet_birthday};
|
|||
pub(crate) trait ReceivedSaplingOutput {
|
||||
fn index(&self) -> usize;
|
||||
fn account(&self) -> AccountId;
|
||||
fn note(&self) -> &Note;
|
||||
fn note(&self) -> &sapling::Note;
|
||||
fn memo(&self) -> Option<&MemoBytes>;
|
||||
fn is_change(&self) -> bool;
|
||||
fn nullifier(&self) -> Option<&sapling::Nullifier>;
|
||||
|
@ -45,7 +45,7 @@ impl ReceivedSaplingOutput for WalletSaplingOutput<sapling::Nullifier, Scope> {
|
|||
fn account(&self) -> AccountId {
|
||||
WalletSaplingOutput::account(self)
|
||||
}
|
||||
fn note(&self) -> &Note {
|
||||
fn note(&self) -> &sapling::Note {
|
||||
WalletSaplingOutput::note(self)
|
||||
}
|
||||
fn memo(&self) -> Option<&MemoBytes> {
|
||||
|
@ -66,14 +66,14 @@ impl ReceivedSaplingOutput for WalletSaplingOutput<sapling::Nullifier, Scope> {
|
|||
}
|
||||
}
|
||||
|
||||
impl ReceivedSaplingOutput for DecryptedOutput<Note> {
|
||||
impl ReceivedSaplingOutput for DecryptedOutput<sapling::Note> {
|
||||
fn index(&self) -> usize {
|
||||
self.index
|
||||
}
|
||||
fn account(&self) -> AccountId {
|
||||
self.account
|
||||
}
|
||||
fn note(&self) -> &Note {
|
||||
fn note(&self) -> &sapling::Note {
|
||||
&self.note
|
||||
}
|
||||
fn memo(&self) -> Option<&MemoBytes> {
|
||||
|
@ -163,7 +163,7 @@ fn to_spendable_note<P: consensus::Parameters>(
|
|||
note_id,
|
||||
txid,
|
||||
output_index,
|
||||
WalletNote::Sapling(sapling::Note::from_parts(
|
||||
Note::Sapling(sapling::Note::from_parts(
|
||||
recipient,
|
||||
note_value.into(),
|
||||
rseed,
|
||||
|
@ -471,10 +471,11 @@ pub(crate) mod tests {
|
|||
use zcash_proofs::prover::LocalTxProver;
|
||||
|
||||
use sapling::{
|
||||
self,
|
||||
note_encryption::try_sapling_output_recovery,
|
||||
prover::{OutputProver, SpendProver},
|
||||
zip32::ExtendedSpendingKey,
|
||||
Node, Note, PaymentAddress,
|
||||
Node, PaymentAddress,
|
||||
};
|
||||
use zcash_primitives::{
|
||||
block::BlockHash,
|
||||
|
@ -1045,7 +1046,7 @@ pub(crate) mod tests {
|
|||
let send_and_recover_with_policy = |st: &mut TestState<BlockCache>,
|
||||
ovk_policy|
|
||||
-> Result<
|
||||
Option<(Note, PaymentAddress, MemoBytes)>,
|
||||
Option<(sapling::Note, PaymentAddress, MemoBytes)>,
|
||||
Error<
|
||||
SqliteClientError,
|
||||
commitment_tree::Error,
|
||||
|
|
Loading…
Reference in New Issue