From 55c075745aab6a2e1bfeeeb0466e77d39dac367a Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Mon, 22 Apr 2024 22:40:16 +0000 Subject: [PATCH 1/4] named TransparentOutput --- zingolib/src/wallet/describe.rs | 6 +++--- zingolib/src/wallet/notes.rs | 2 +- zingolib/src/wallet/notes/transparent.rs | 14 +++++++------- zingolib/src/wallet/send.rs | 4 ++-- zingolib/src/wallet/transaction_record.rs | 5 +++-- zingolib/src/wallet/transactions/recording.rs | 2 +- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/zingolib/src/wallet/describe.rs b/zingolib/src/wallet/describe.rs index 8eadcdcba..363e25246 100644 --- a/zingolib/src/wallet/describe.rs +++ b/zingolib/src/wallet/describe.rs @@ -18,7 +18,7 @@ use crate::wallet::notes::ShieldedNoteInterface; use crate::wallet::traits::Diversifiable as _; use super::keys::unified::{Capability, WalletCapability}; -use super::notes::TransparentNote; +use super::notes::TransparentOutput; use super::traits::DomainWalletExt; use super::traits::Recipient; @@ -247,7 +247,7 @@ impl LightWallet { } /// Get all (unspent) utxos. Unconfirmed spent utxos are included - pub async fn get_utxos(&self) -> Vec { + pub async fn get_utxos(&self) -> Vec { self.transaction_context .transaction_metadata_set .read() @@ -261,7 +261,7 @@ impl LightWallet { .filter(|utxo| !utxo.is_spent()) }) .cloned() - .collect::>() + .collect::>() } /// TODO: Add Doc Comment Here! diff --git a/zingolib/src/wallet/notes.rs b/zingolib/src/wallet/notes.rs index a68369767..eea431e35 100644 --- a/zingolib/src/wallet/notes.rs +++ b/zingolib/src/wallet/notes.rs @@ -3,7 +3,7 @@ pub mod interface; pub use interface::NoteInterface; pub use interface::ShieldedNoteInterface; pub mod transparent; -pub use transparent::TransparentNote; +pub use transparent::TransparentOutput; pub mod sapling; pub use sapling::SaplingNote; pub mod orchard; diff --git a/zingolib/src/wallet/notes/transparent.rs b/zingolib/src/wallet/notes/transparent.rs index 2f134b245..8d7e6959f 100644 --- a/zingolib/src/wallet/notes/transparent.rs +++ b/zingolib/src/wallet/notes/transparent.rs @@ -10,7 +10,7 @@ use super::NoteInterface; /// TODO: Add Doc Comment Here! #[derive(Clone, Debug, PartialEq)] -pub struct TransparentNote { +pub struct TransparentOutput { /// TODO: Add Doc Comment Here! pub address: String, /// TODO: Add Doc Comment Here! @@ -29,7 +29,7 @@ pub struct TransparentNote { pub unconfirmed_spent: Option<(TxId, u32)>, } -impl NoteInterface for TransparentNote { +impl NoteInterface for TransparentOutput { fn pool_type(&self) -> PoolType { PoolType::Transparent } @@ -51,7 +51,7 @@ impl NoteInterface for TransparentNote { } } -impl TransparentNote { +impl TransparentOutput { /// TODO: Add Doc Comment Here! pub fn from_parts( address: String, @@ -175,7 +175,7 @@ impl TransparentNote { None }; - Ok(TransparentNote { + Ok(TransparentOutput { address, txid: transaction_id, output_index, @@ -192,7 +192,7 @@ pub mod mocks { //! Mock version of the struct for testing use zcash_primitives::transaction::TxId; - use crate::{test_framework::mocks::build_method, wallet::notes::TransparentNote}; + use crate::{test_framework::mocks::build_method, wallet::notes::TransparentOutput}; /// to create a mock TransparentNote pub struct TransparentNoteBuilder { @@ -228,8 +228,8 @@ pub mod mocks { build_method!(unconfirmed_spent, Option<(TxId, u32)>); /// builds a mock TransparentNote after all pieces are supplied - pub fn build(self) -> TransparentNote { - TransparentNote::from_parts( + pub fn build(self) -> TransparentOutput { + TransparentOutput::from_parts( self.address.unwrap(), self.txid.unwrap(), self.output_index.unwrap(), diff --git a/zingolib/src/wallet/send.rs b/zingolib/src/wallet/send.rs index 8678caec9..1333c328d 100644 --- a/zingolib/src/wallet/send.rs +++ b/zingolib/src/wallet/send.rs @@ -613,7 +613,7 @@ impl LightWallet { ( Vec, Vec, - Vec, + Vec, u64, ), u64, @@ -750,7 +750,7 @@ impl LightWallet { witness_trees: &WitnessTrees, orchard_notes: &[SpendableOrchardNote], sapling_notes: &[SpendableSaplingNote], - utxos: &[notes::TransparentNote], + utxos: &[notes::TransparentOutput], ) -> Result, String> { // Add all tinputs // Create a map from address -> sk for all taddrs, so we can spend from the diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index c67efd962..b21a684b5 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -42,7 +42,7 @@ pub struct TransactionRecord { pub orchard_notes: Vec, /// List of all Utxos by this wallet received in this Tx. Some of these might be change notes - pub transparent_notes: Vec, + pub transparent_notes: Vec, /// Total value of all the sapling nullifiers that were spent by this wallet in this Tx pub total_sapling_value_spent: u64, @@ -261,7 +261,8 @@ impl TransactionRecord { } else { vec![] }; - let utxos = zcash_encoding::Vector::read(&mut reader, |r| notes::TransparentNote::read(r))?; + let utxos = + zcash_encoding::Vector::read(&mut reader, |r| notes::TransparentOutput::read(r))?; let total_sapling_value_spent = reader.read_u64::()?; let total_transparent_value_spent = reader.read_u64::()?; diff --git a/zingolib/src/wallet/transactions/recording.rs b/zingolib/src/wallet/transactions/recording.rs index 91e8d35b5..331238958 100644 --- a/zingolib/src/wallet/transactions/recording.rs +++ b/zingolib/src/wallet/transactions/recording.rs @@ -311,7 +311,7 @@ impl TxMapAndMaybeTrees { // If it already exists, it is likely an mempool tx, so update the height } else { transaction_metadata.transparent_notes.push( - crate::wallet::notes::TransparentNote::from_parts( + crate::wallet::notes::TransparentOutput::from_parts( taddr, txid, output_num as u64, From 9f2130743dfc7da6151ff5020cd9576b13119e60 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Mon, 22 Apr 2024 22:40:47 +0000 Subject: [PATCH 2/4] named transparent_outputs --- zingolib/src/lightclient/deprecated.rs | 4 ++-- zingolib/src/lightclient/describe.rs | 6 +++--- zingolib/src/wallet/describe.rs | 2 +- zingolib/src/wallet/transaction_context.rs | 2 +- zingolib/src/wallet/transaction_record.rs | 14 +++++++------- zingolib/src/wallet/transaction_records_by_id.rs | 4 ++-- zingolib/src/wallet/transactions/recording.rs | 6 +++--- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/zingolib/src/lightclient/deprecated.rs b/zingolib/src/lightclient/deprecated.rs index d87fcf652..30a41e211 100644 --- a/zingolib/src/lightclient/deprecated.rs +++ b/zingolib/src/lightclient/deprecated.rs @@ -122,7 +122,7 @@ impl LightClient { .flat_map(|(txid, wallet_transaction)| { let mut consumer_notes_by_tx: Vec = vec![]; - let total_transparent_received = wallet_transaction.transparent_notes.iter().map(|u| u.value).sum::(); + let total_transparent_received = wallet_transaction.transparent_outputs.iter().map(|u| u.value).sum::(); if wallet_transaction.is_outgoing_transaction() { // If money was spent, create a consumer_ui_note. For this, we'll subtract // all the change notes + Utxos @@ -138,7 +138,7 @@ impl LightClient { // Get the total transparent value received in this transaction // Again we see the assumption that utxos are incoming. let net_transparent_value = total_transparent_received as i64 - wallet_transaction.get_transparent_value_spent() as i64; - let address = wallet_transaction.transparent_notes.iter().map(|utxo| utxo.address.clone()).collect::>().join(","); + let address = wallet_transaction.transparent_outputs.iter().map(|utxo| utxo.address.clone()).collect::>().join(","); if net_transparent_value > 0 { if let Some(transaction) = consumer_notes_by_tx.iter_mut().find(|transaction| transaction["txid"] == txid.to_string()) { // If this transaction is outgoing: diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index 235a61250..2dc1ce551 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -150,7 +150,7 @@ impl LightClient { } }); - tx.transparent_notes + tx.transparent_outputs .iter() .filter(|n| !n.is_spent() && n.unconfirmed_spent.is_none()) .for_each(|n| { @@ -403,7 +403,7 @@ impl LightClient { } // No funds spent, this is a normal receipt (false, true) => { - for received_transparent in transaction_md.transparent_notes.iter() { + for received_transparent in transaction_md.transparent_outputs.iter() { summaries.push(ValueTransfer { block_height, datetime, @@ -588,7 +588,7 @@ impl LightClient { self.wallet.transaction_context.transaction_metadata_set.read().await.transaction_records_by_id.iter() .flat_map( |(transaction_id, wtx)| { - wtx.transparent_notes.iter().filter_map(move |utxo| + wtx.transparent_outputs.iter().filter_map(move |utxo| if !all_notes && utxo.is_spent() { None } else { diff --git a/zingolib/src/wallet/describe.rs b/zingolib/src/wallet/describe.rs index 363e25246..b596e4796 100644 --- a/zingolib/src/wallet/describe.rs +++ b/zingolib/src/wallet/describe.rs @@ -256,7 +256,7 @@ impl LightWallet { .values() .flat_map(|transaction| { transaction - .transparent_notes + .transparent_outputs .iter() .filter(|utxo| !utxo.is_spent()) }) diff --git a/zingolib/src/wallet/transaction_context.rs b/zingolib/src/wallet/transaction_context.rs index a2d5476f1..7424edbb4 100644 --- a/zingolib/src/wallet/transaction_context.rs +++ b/zingolib/src/wallet/transaction_context.rs @@ -253,7 +253,7 @@ pub mod decrypt_transaction { { // One of the tx outputs is a match if let Some(spent_utxo) = wtx - .transparent_notes + .transparent_outputs .iter() .find(|u| u.txid == prev_transaction_id && u.output_index == prev_n) { diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index b21a684b5..49911c44e 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -42,7 +42,7 @@ pub struct TransactionRecord { pub orchard_notes: Vec, /// List of all Utxos by this wallet received in this Tx. Some of these might be change notes - pub transparent_notes: Vec, + pub transparent_outputs: Vec, /// Total value of all the sapling nullifiers that were spent by this wallet in this Tx pub total_sapling_value_spent: u64, @@ -76,7 +76,7 @@ impl TransactionRecord { spent_orchard_nullifiers: vec![], sapling_notes: vec![], orchard_notes: vec![], - transparent_notes: vec![], + transparent_outputs: vec![], total_transparent_value_spent: 0, total_sapling_value_spent: 0, total_orchard_value_spent: 0, @@ -142,7 +142,7 @@ impl TransactionRecord { .orchard_notes .iter() .any(|note| !notes::ShieldedNoteInterface::is_change(note)) - || !self.transparent_notes.is_empty() + || !self.transparent_outputs.is_empty() } /// TODO: Add Doc Comment Here! @@ -183,7 +183,7 @@ impl TransactionRecord { self.pool_value_received::() + self.pool_value_received::() + self - .transparent_notes + .transparent_outputs .iter() .map(|utxo| utxo.value) .sum::() @@ -310,7 +310,7 @@ impl TransactionRecord { txid: transaction_id, sapling_notes, orchard_notes, - transparent_notes: utxos, + transparent_outputs: utxos, spent_sapling_nullifiers, spent_orchard_nullifiers, total_sapling_value_spent, @@ -341,7 +341,7 @@ impl TransactionRecord { zcash_encoding::Vector::write(&mut writer, &self.sapling_notes, |w, nd| nd.write(w))?; zcash_encoding::Vector::write(&mut writer, &self.orchard_notes, |w, nd| nd.write(w))?; - zcash_encoding::Vector::write(&mut writer, &self.transparent_notes, |w, u| u.write(w))?; + zcash_encoding::Vector::write(&mut writer, &self.transparent_outputs, |w, u| u.write(w))?; for pool in self.value_spent_by_pool() { writer.write_u64::(pool)?; @@ -460,7 +460,7 @@ mod tests { // A single transparent note makes is_incoming_transaction true. let mut transaction_record = TransactionRecordBuilder::default().build(); transaction_record - .transparent_notes + .transparent_outputs .push(TransparentNoteBuilder::default().build()); assert!(transaction_record.is_incoming_transaction()); } diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index 90b69fec2..9ea8019af 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -98,7 +98,7 @@ impl TransactionRecordsById { self.values_mut().for_each(|transaction_metadata| { // Update UTXOs to roll back any spent utxos transaction_metadata - .transparent_notes + .transparent_outputs .iter_mut() .for_each(|utxo| { if utxo.is_spent() && invalidated_txids.contains(&utxo.spent().unwrap().0) { @@ -168,7 +168,7 @@ mod tests { .status(Confirmed(5.into())) .build(); transaction_record_early - .transparent_notes + .transparent_outputs .push(TransparentNoteBuilder::default().build()); let mut transaction_record_later = TransactionRecordBuilder::default() diff --git a/zingolib/src/wallet/transactions/recording.rs b/zingolib/src/wallet/transactions/recording.rs index 331238958..2d826f4c2 100644 --- a/zingolib/src/wallet/transactions/recording.rs +++ b/zingolib/src/wallet/transactions/recording.rs @@ -260,7 +260,7 @@ impl TxMapAndMaybeTrees { self.transaction_records_by_id.get_mut(&spent_txid) { if let Some(spent_utxo) = utxo_transacion_metadata - .transparent_notes + .transparent_outputs .iter_mut() .find(|u| u.txid == spent_txid && u.output_index == output_num as u64) { @@ -304,13 +304,13 @@ impl TxMapAndMaybeTrees { // Add this UTXO if it doesn't already exist if transaction_metadata - .transparent_notes + .transparent_outputs .iter_mut() .any(|utxo| utxo.txid == txid && utxo.output_index == output_num as u64) { // If it already exists, it is likely an mempool tx, so update the height } else { - transaction_metadata.transparent_notes.push( + transaction_metadata.transparent_outputs.push( crate::wallet::notes::TransparentOutput::from_parts( taddr, txid, From f0575539cd59f9db99c5823d9431b8fec30348fd Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Tue, 23 Apr 2024 00:44:34 +0000 Subject: [PATCH 3/4] renamed TransparentOutputBuilder --- zingolib/src/wallet/notes.rs | 8 ++++---- zingolib/src/wallet/notes/transparent.rs | 8 ++++---- zingolib/src/wallet/transaction_record.rs | 4 ++-- zingolib/src/wallet/transaction_records_by_id.rs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/zingolib/src/wallet/notes.rs b/zingolib/src/wallet/notes.rs index eea431e35..c44c927f4 100644 --- a/zingolib/src/wallet/notes.rs +++ b/zingolib/src/wallet/notes.rs @@ -132,7 +132,7 @@ pub mod tests { test_framework::mocks::default_txid, wallet::notes::{ query::NoteQuery, sapling::mocks::SaplingNoteBuilder, - transparent::mocks::TransparentNoteBuilder, NoteInterface, + transparent::mocks::TransparentOutputBuilder, NoteInterface, }, }; @@ -142,11 +142,11 @@ pub mod tests { fn note_queries() { let spend = Some((default_txid(), 112358)); - let transparent_unspent_note = TransparentNoteBuilder::default().build(); - let transparent_pending_spent_note = TransparentNoteBuilder::default() + let transparent_unspent_note = TransparentOutputBuilder::default().build(); + let transparent_pending_spent_note = TransparentOutputBuilder::default() .unconfirmed_spent(spend) .build(); - let transparent_spent_note = TransparentNoteBuilder::default().spent(spend).build(); + let transparent_spent_note = TransparentOutputBuilder::default().spent(spend).build(); let sapling_unspent_note = SaplingNoteBuilder::default().build(); let sapling_pending_spent_note = SaplingNoteBuilder::default() .unconfirmed_spent(spend) diff --git a/zingolib/src/wallet/notes/transparent.rs b/zingolib/src/wallet/notes/transparent.rs index 8d7e6959f..3a662c50a 100644 --- a/zingolib/src/wallet/notes/transparent.rs +++ b/zingolib/src/wallet/notes/transparent.rs @@ -194,8 +194,8 @@ pub mod mocks { use crate::{test_framework::mocks::build_method, wallet::notes::TransparentOutput}; - /// to create a mock TransparentNote - pub struct TransparentNoteBuilder { + /// to create a mock TransparentOutput + pub struct TransparentOutputBuilder { address: Option, txid: Option, output_index: Option, @@ -205,7 +205,7 @@ pub mod mocks { unconfirmed_spent: Option>, } #[allow(dead_code)] //TODO: fix this gross hack that I tossed in to silence the language-analyzer false positive - impl TransparentNoteBuilder { + impl TransparentOutputBuilder { /// blank builder pub fn new() -> Self { Self { @@ -241,7 +241,7 @@ pub mod mocks { } } - impl Default for TransparentNoteBuilder { + impl Default for TransparentOutputBuilder { fn default() -> Self { Self::new() .address("default_address".to_string()) diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index 49911c44e..860d1cb14 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -430,7 +430,7 @@ pub mod mocks { #[cfg(test)] mod tests { - use crate::wallet::notes::transparent::mocks::TransparentNoteBuilder; + use crate::wallet::notes::transparent::mocks::TransparentOutputBuilder; use crate::wallet::transaction_record::mocks::TransactionRecordBuilder; #[test] @@ -461,7 +461,7 @@ mod tests { let mut transaction_record = TransactionRecordBuilder::default().build(); transaction_record .transparent_outputs - .push(TransparentNoteBuilder::default().build()); + .push(TransparentOutputBuilder::default().build()); assert!(transaction_record.is_incoming_transaction()); } } diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index 9ea8019af..1d7cbd5dd 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -152,7 +152,7 @@ impl Default for TransactionRecordsById { #[cfg(test)] mod tests { use crate::wallet::{ - notes::{sapling::mocks::SaplingNoteBuilder, transparent::mocks::TransparentNoteBuilder}, + notes::{sapling::mocks::SaplingNoteBuilder, transparent::mocks::TransparentOutputBuilder}, transaction_record::mocks::TransactionRecordBuilder, }; @@ -169,7 +169,7 @@ mod tests { .build(); transaction_record_early .transparent_outputs - .push(TransparentNoteBuilder::default().build()); + .push(TransparentOutputBuilder::default().build()); let mut transaction_record_later = TransactionRecordBuilder::default() .randomize_txid() From b22e3fad6c45d5e91f722347acc6947487f77531 Mon Sep 17 00:00:00 2001 From: fluidvanadium Date: Tue, 23 Apr 2024 16:52:40 +0000 Subject: [PATCH 4/4] named OutputInterface --- zingolib/src/lightclient/deprecated.rs | 2 +- zingolib/src/lightclient/describe.rs | 2 +- zingolib/src/wallet/describe.rs | 4 ++-- zingolib/src/wallet/notes.rs | 4 ++-- zingolib/src/wallet/notes/interface.rs | 4 ++-- zingolib/src/wallet/notes/orchard.rs | 4 ++-- zingolib/src/wallet/notes/sapling.rs | 4 ++-- zingolib/src/wallet/notes/transparent.rs | 4 ++-- zingolib/src/wallet/send.rs | 2 +- zingolib/src/wallet/traits.rs | 2 +- zingolib/src/wallet/transaction_record.rs | 2 +- zingolib/src/wallet/transaction_records_by_id.rs | 2 +- zingolib/src/wallet/transactions/get.rs | 2 +- zingolib/src/wallet/transactions/recording.rs | 2 +- 14 files changed, 20 insertions(+), 20 deletions(-) diff --git a/zingolib/src/lightclient/deprecated.rs b/zingolib/src/lightclient/deprecated.rs index 6ad3f5430..61824e99d 100644 --- a/zingolib/src/lightclient/deprecated.rs +++ b/zingolib/src/lightclient/deprecated.rs @@ -3,7 +3,7 @@ use std::cmp; use crate::wallet::transaction_record::TransactionRecord; use super::*; -use crate::wallet::notes::NoteInterface; +use crate::wallet::notes::OutputInterface; use crate::wallet::notes::ShieldedNoteInterface; use zcash_note_encryption::Domain; diff --git a/zingolib/src/lightclient/describe.rs b/zingolib/src/lightclient/describe.rs index 250a9dade..2407fed9f 100644 --- a/zingolib/src/lightclient/describe.rs +++ b/zingolib/src/lightclient/describe.rs @@ -24,7 +24,7 @@ use crate::{ TransactionRecord, }, keys::address_from_pubkeyhash, - notes::NoteInterface, + notes::OutputInterface, LightWallet, Pool, }, }; diff --git a/zingolib/src/wallet/describe.rs b/zingolib/src/wallet/describe.rs index 570bdff92..9c1d23b45 100644 --- a/zingolib/src/wallet/describe.rs +++ b/zingolib/src/wallet/describe.rs @@ -12,7 +12,7 @@ use zcash_note_encryption::Domain; use zcash_primitives::consensus::BlockHeight; use crate::wallet::data::TransactionRecord; -use crate::wallet::notes::NoteInterface; +use crate::wallet::notes::OutputInterface; use crate::wallet::notes::ShieldedNoteInterface; use crate::wallet::traits::Diversifiable as _; @@ -70,7 +70,7 @@ impl LightWallet { filtered_notes .map(|notedata| { if notedata.spent().is_none() && notedata.pending_spent().is_none() { - ::value(notedata) + ::value(notedata) } else { 0 } diff --git a/zingolib/src/wallet/notes.rs b/zingolib/src/wallet/notes.rs index 141bb03b5..3bb9d9e9b 100644 --- a/zingolib/src/wallet/notes.rs +++ b/zingolib/src/wallet/notes.rs @@ -1,6 +1,6 @@ //! All things needed to create, manaage, and use notes pub mod interface; -pub use interface::NoteInterface; +pub use interface::OutputInterface; pub use interface::ShieldedNoteInterface; pub mod transparent; pub use transparent::TransparentOutput; @@ -132,7 +132,7 @@ pub mod tests { test_framework::mocks::default_txid, wallet::notes::{ query::OutputQuery, sapling::mocks::SaplingNoteBuilder, - transparent::mocks::TransparentOutputBuilder, NoteInterface, + transparent::mocks::TransparentOutputBuilder, OutputInterface, }, }; diff --git a/zingolib/src/wallet/notes/interface.rs b/zingolib/src/wallet/notes/interface.rs index 7481bb09a..322940e38 100644 --- a/zingolib/src/wallet/notes/interface.rs +++ b/zingolib/src/wallet/notes/interface.rs @@ -14,7 +14,7 @@ use super::{ }; /// TODO: Add Doc Comment Here! -pub trait NoteInterface: Sized { +pub trait OutputInterface: Sized { /// returns the zcash_client_backend PoolType enum (one of 3) fn pool_type(&self) -> PoolType; @@ -71,7 +71,7 @@ pub trait NoteInterface: Sized { } /// ShieldedNotes are either part of a Sapling or Orchard Pool -pub trait ShieldedNoteInterface: NoteInterface + Sized { +pub trait ShieldedNoteInterface: OutputInterface + Sized { /// TODO: Add Doc Comment Here! type Diversifier: Copy + FromBytes<11> + ToBytes<11>; /// TODO: Add Doc Comment Here! diff --git a/zingolib/src/wallet/notes/orchard.rs b/zingolib/src/wallet/notes/orchard.rs index a448394a4..7a4a920d0 100644 --- a/zingolib/src/wallet/notes/orchard.rs +++ b/zingolib/src/wallet/notes/orchard.rs @@ -5,7 +5,7 @@ use zcash_primitives::{memo::Memo, transaction::TxId}; use super::{ super::{data::TransactionRecord, Pool}, - NoteInterface, ShieldedNoteInterface, + OutputInterface, ShieldedNoteInterface, }; /// TODO: Add Doc Comment Here! @@ -42,7 +42,7 @@ pub struct OrchardNote { pub have_spending_key: bool, } -impl NoteInterface for OrchardNote { +impl OutputInterface for OrchardNote { fn pool_type(&self) -> PoolType { PoolType::Shielded(ShieldedProtocol::Orchard) } diff --git a/zingolib/src/wallet/notes/sapling.rs b/zingolib/src/wallet/notes/sapling.rs index d60a4444c..a7342c5e0 100644 --- a/zingolib/src/wallet/notes/sapling.rs +++ b/zingolib/src/wallet/notes/sapling.rs @@ -5,7 +5,7 @@ use zcash_primitives::{memo::Memo, transaction::TxId}; use super::{ super::{data::TransactionRecord, Pool}, - NoteInterface, ShieldedNoteInterface, + OutputInterface, ShieldedNoteInterface, }; /// TODO: Add Doc Comment Here! @@ -62,7 +62,7 @@ impl std::fmt::Debug for SaplingNote { } } -impl NoteInterface for SaplingNote { +impl OutputInterface for SaplingNote { fn pool_type(&self) -> PoolType { PoolType::Shielded(ShieldedProtocol::Sapling) } diff --git a/zingolib/src/wallet/notes/transparent.rs b/zingolib/src/wallet/notes/transparent.rs index 201c31ef7..32944cd21 100644 --- a/zingolib/src/wallet/notes/transparent.rs +++ b/zingolib/src/wallet/notes/transparent.rs @@ -6,7 +6,7 @@ use byteorder::{ReadBytesExt, WriteBytesExt}; use zcash_client_backend::PoolType; use zcash_primitives::transaction::{components::OutPoint, TxId}; -use super::NoteInterface; +use super::OutputInterface; /// TODO: Add Doc Comment Here! #[derive(Clone, Debug, PartialEq)] @@ -29,7 +29,7 @@ pub struct TransparentOutput { pub unconfirmed_spent: Option<(TxId, u32)>, } -impl NoteInterface for TransparentOutput { +impl OutputInterface for TransparentOutput { fn pool_type(&self) -> PoolType { PoolType::Transparent } diff --git a/zingolib/src/wallet/send.rs b/zingolib/src/wallet/send.rs index 1333c328d..ef814a17d 100644 --- a/zingolib/src/wallet/send.rs +++ b/zingolib/src/wallet/send.rs @@ -1,6 +1,6 @@ //! This mod contains pieces of the impl LightWallet that are invoked during a send. use crate::wallet::data::SpendableSaplingNote; -use crate::wallet::notes::NoteInterface; +use crate::wallet::notes::OutputInterface; use crate::wallet::now; use futures::Future; diff --git a/zingolib/src/wallet/traits.rs b/zingolib/src/wallet/traits.rs index 77ec32c12..96bb69bc0 100644 --- a/zingolib/src/wallet/traits.rs +++ b/zingolib/src/wallet/traits.rs @@ -10,7 +10,7 @@ use super::{ notes::{OrchardNote, SaplingNote}, transactions::TxMapAndMaybeTrees, }; -use crate::wallet::notes::NoteInterface; +use crate::wallet::notes::OutputInterface; use crate::wallet::notes::ShieldedNoteInterface; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use incrementalmerkletree::{witness::IncrementalWitness, Hashable, Level, Position}; diff --git a/zingolib/src/wallet/transaction_record.rs b/zingolib/src/wallet/transaction_record.rs index e80b9416c..18bca78df 100644 --- a/zingolib/src/wallet/transaction_record.rs +++ b/zingolib/src/wallet/transaction_record.rs @@ -9,7 +9,7 @@ use zcash_client_backend::PoolType; use zcash_primitives::{consensus::BlockHeight, transaction::TxId}; use crate::error::ZingoLibError; -use crate::wallet::notes::interface::NoteInterface; +use crate::wallet::notes::interface::OutputInterface; use crate::wallet::traits::ReadableWriteable; use crate::wallet::{ data::{OutgoingTxData, PoolNullifier, COMMITMENT_TREE_LEVELS}, diff --git a/zingolib/src/wallet/transaction_records_by_id.rs b/zingolib/src/wallet/transaction_records_by_id.rs index 3c5005c97..95965d13c 100644 --- a/zingolib/src/wallet/transaction_records_by_id.rs +++ b/zingolib/src/wallet/transaction_records_by_id.rs @@ -13,7 +13,7 @@ use zcash_primitives::transaction::TxId; use crate::wallet::{ data::TransactionRecord, - notes::NoteInterface, + notes::OutputInterface, traits::{DomainWalletExt, Recipient}, }; diff --git a/zingolib/src/wallet/transactions/get.rs b/zingolib/src/wallet/transactions/get.rs index a84683254..1c78eaf8c 100644 --- a/zingolib/src/wallet/transactions/get.rs +++ b/zingolib/src/wallet/transactions/get.rs @@ -3,7 +3,7 @@ use zcash_primitives::{consensus::BlockHeight, transaction::TxId}; use crate::wallet::{ data::{PoolNullifier, TransactionRecord}, - notes::NoteInterface, + notes::OutputInterface, notes::ShieldedNoteInterface, traits::{DomainWalletExt, Recipient}, }; diff --git a/zingolib/src/wallet/transactions/recording.rs b/zingolib/src/wallet/transactions/recording.rs index 5757977d1..52e767207 100644 --- a/zingolib/src/wallet/transactions/recording.rs +++ b/zingolib/src/wallet/transactions/recording.rs @@ -9,7 +9,7 @@ use crate::{ error::{ZingoLibError, ZingoLibResult}, wallet::{ data::PoolNullifier, - notes::NoteInterface, + notes::OutputInterface, notes::ShieldedNoteInterface, traits::{self, DomainWalletExt, Nullifier, Recipient}, },