diff --git a/zcash_client_backend/CHANGELOG.md b/zcash_client_backend/CHANGELOG.md index ab9d2277c..62f908015 100644 --- a/zcash_client_backend/CHANGELOG.md +++ b/zcash_client_backend/CHANGELOG.md @@ -181,6 +181,9 @@ and this library adheres to Rust's notion of - `ReceivedSaplingNote::value` - `WalletTransparentOutput::value` +- `zcash_client_backend::address`: + - `RecipientAddress::Shielded` has been renamed to `RecipientAddress::Sapling` + ### Removed - `zcash_client_backend::wallet::ReceivedSaplingNote` has been replaced by `zcash_client_backend::ReceivedNote`. diff --git a/zcash_client_backend/src/address.rs b/zcash_client_backend/src/address.rs index d2386ddf6..30c0ee029 100644 --- a/zcash_client_backend/src/address.rs +++ b/zcash_client_backend/src/address.rs @@ -176,14 +176,14 @@ impl UnifiedAddress { // TODO: rename to ParsedAddress #[derive(Debug, PartialEq, Eq, Clone)] pub enum RecipientAddress { - Shielded(PaymentAddress), + Sapling(PaymentAddress), Transparent(TransparentAddress), Unified(UnifiedAddress), } impl From for RecipientAddress { fn from(addr: PaymentAddress) -> Self { - RecipientAddress::Shielded(addr) + RecipientAddress::Sapling(addr) } } @@ -237,7 +237,7 @@ impl RecipientAddress { let net = params.address_network().expect("Unrecognized network"); match self { - RecipientAddress::Shielded(pa) => ZcashAddress::from_sapling(net, pa.to_bytes()), + RecipientAddress::Sapling(pa) => ZcashAddress::from_sapling(net, pa.to_bytes()), RecipientAddress::Transparent(addr) => match addr { TransparentAddress::PublicKey(data) => { ZcashAddress::from_transparent_p2pkh(net, *data) diff --git a/zcash_client_backend/src/data_api/wallet.rs b/zcash_client_backend/src/data_api/wallet.rs index 78ded00a7..161d282c7 100644 --- a/zcash_client_backend/src/data_api/wallet.rs +++ b/zcash_client_backend/src/data_api/wallet.rs @@ -679,7 +679,7 @@ where ))); } } - RecipientAddress::Shielded(addr) => { + RecipientAddress::Sapling(addr) => { let memo = payment .memo .as_ref() diff --git a/zcash_client_backend/src/data_api/wallet/input_selection.rs b/zcash_client_backend/src/data_api/wallet/input_selection.rs index 564b12c75..e9745ee27 100644 --- a/zcash_client_backend/src/data_api/wallet/input_selection.rs +++ b/zcash_client_backend/src/data_api/wallet/input_selection.rs @@ -513,7 +513,7 @@ where RecipientAddress::Transparent(addr) => { push_transparent(*addr); } - RecipientAddress::Shielded(_) => { + RecipientAddress::Sapling(_) => { push_sapling(); } RecipientAddress::Unified(addr) => { diff --git a/zcash_client_backend/src/zip321.rs b/zcash_client_backend/src/zip321.rs index eea0a4001..aec430099 100644 --- a/zcash_client_backend/src/zip321.rs +++ b/zcash_client_backend/src/zip321.rs @@ -554,7 +554,7 @@ mod parse { match v { Param::Amount(a) => payment.amount = a, Param::Memo(m) => match payment.recipient_address { - RecipientAddress::Shielded(_) | RecipientAddress::Unified(_) => { + RecipientAddress::Sapling(_) | RecipientAddress::Unified(_) => { payment.memo = Some(m) } RecipientAddress::Transparent(_) => { @@ -770,7 +770,7 @@ pub mod testing { pub fn arb_addr() -> impl Strategy { prop_oneof![ - arb_payment_address().prop_map(RecipientAddress::Shielded), + arb_payment_address().prop_map(RecipientAddress::Sapling), arb_transparent_addr().prop_map(RecipientAddress::Transparent), arb_unified_addr().prop_map(RecipientAddress::Unified), ] @@ -797,7 +797,7 @@ pub mod testing { let is_shielded = match recipient_address { RecipientAddress::Transparent(_) => false, - RecipientAddress::Shielded(_) | RecipientAddress::Unified(_) => true, + RecipientAddress::Sapling(_) | RecipientAddress::Unified(_) => true, }; Payment { @@ -899,7 +899,7 @@ mod tests { let expected = TransactionRequest { payments: vec![ Payment { - recipient_address: RecipientAddress::Shielded(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), + recipient_address: RecipientAddress::Sapling(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), amount: NonNegativeAmount::const_from_u64(376876902796286), memo: None, label: None, @@ -920,7 +920,7 @@ mod tests { let expected = TransactionRequest { payments: vec![ Payment { - recipient_address: RecipientAddress::Shielded(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), + recipient_address: RecipientAddress::Sapling(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), amount: NonNegativeAmount::ZERO, memo: None, label: None, @@ -938,7 +938,7 @@ mod tests { let req = TransactionRequest { payments: vec![ Payment { - recipient_address: RecipientAddress::Shielded(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), + recipient_address: RecipientAddress::Sapling(decode_payment_address(TEST_NETWORK.hrp_sapling_payment_address(), "ztestsapling1n65uaftvs2g7075q2x2a04shfk066u3lldzxsrprfrqtzxnhc9ps73v4lhx4l9yfxj46sl0q90k").unwrap()), amount: NonNegativeAmount::ZERO, memo: None, label: None, diff --git a/zcash_client_sqlite/src/chain.rs b/zcash_client_sqlite/src/chain.rs index 8a9d582b5..438c46b7c 100644 --- a/zcash_client_sqlite/src/chain.rs +++ b/zcash_client_sqlite/src/chain.rs @@ -520,7 +520,7 @@ mod tests { // We can spend the received notes let req = TransactionRequest::new(vec![Payment { - recipient_address: RecipientAddress::Shielded(dfvk.default_address().1), + recipient_address: RecipientAddress::Sapling(dfvk.default_address().1), amount: NonNegativeAmount::const_from_u64(110_000), memo: None, label: None, diff --git a/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs b/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs index 151230c0f..7f13aa05e 100644 --- a/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs +++ b/zcash_client_sqlite/src/wallet/init/migrations/ufvk_support.rs @@ -88,7 +88,7 @@ impl RusqliteMigration for Migration

{ )) })?; match decoded { - RecipientAddress::Shielded(decoded_address) => { + RecipientAddress::Sapling(decoded_address) => { let dfvk = ufvk.sapling().expect( "Derivation should have produced a UFVK containing a Sapling component.", ); @@ -97,7 +97,7 @@ impl RusqliteMigration for Migration

{ return Err(WalletMigrationError::CorruptedData( format!("Decoded Sapling address {} does not match the ufvk's Sapling address {} at {:?}.", address, - RecipientAddress::Shielded(expected_address).encode(&self.params), + RecipientAddress::Sapling(expected_address).encode(&self.params), idx))); } } @@ -226,7 +226,7 @@ impl RusqliteMigration for Migration

{ )) })?; let output_pool = match decoded_address { - RecipientAddress::Shielded(_) => { + RecipientAddress::Sapling(_) => { Ok(pool_code(PoolType::Shielded(ShieldedProtocol::Sapling))) } RecipientAddress::Transparent(_) => Ok(pool_code(PoolType::Transparent)), diff --git a/zcash_client_sqlite/src/wallet/sapling.rs b/zcash_client_sqlite/src/wallet/sapling.rs index fa5a4fc8b..81170e22c 100644 --- a/zcash_client_sqlite/src/wallet/sapling.rs +++ b/zcash_client_sqlite/src/wallet/sapling.rs @@ -1275,7 +1275,7 @@ pub(crate) mod tests { let req = TransactionRequest::new(vec![ // payment to an external recipient Payment { - recipient_address: RecipientAddress::Shielded(addr2), + recipient_address: RecipientAddress::Sapling(addr2), amount: amount_sent, memo: None, label: None, @@ -1284,7 +1284,7 @@ pub(crate) mod tests { }, // payment back to the originating wallet, simulating legacy change Payment { - recipient_address: RecipientAddress::Shielded(addr), + recipient_address: RecipientAddress::Sapling(addr), amount: amount_legacy_change, memo: None, label: None, @@ -1398,7 +1398,7 @@ pub(crate) mod tests { // This first request will fail due to insufficient non-dust funds let req = TransactionRequest::new(vec![Payment { - recipient_address: RecipientAddress::Shielded(dfvk.default_address().1), + recipient_address: RecipientAddress::Sapling(dfvk.default_address().1), amount: NonNegativeAmount::const_from_u64(50000), memo: None, label: None, @@ -1423,7 +1423,7 @@ pub(crate) mod tests { // This request will succeed, spending a single dust input to pay the 10000 // ZAT fee in addition to the 41000 ZAT output to the recipient let req = TransactionRequest::new(vec![Payment { - recipient_address: RecipientAddress::Shielded(dfvk.default_address().1), + recipient_address: RecipientAddress::Sapling(dfvk.default_address().1), amount: NonNegativeAmount::const_from_u64(41000), memo: None, label: None,