Skip to content

Commit

Permalink
zcash_client_sqlite: Fix tests that broke with the addition of Orchar…
Browse files Browse the repository at this point in the history
…d UA receivers.
  • Loading branch information
nuttycom committed Mar 22, 2024
1 parent cb218ad commit 6f1e4af
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions zcash_client_sqlite/src/wallet/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ mod tests {
address::Address,
data_api::scanning::ScanPriority,
encoding::{encode_extended_full_viewing_key, encode_payment_address},
keys::{sapling, UnifiedFullViewingKey, UnifiedSpendingKey},
keys::{sapling, UnifiedAddressRequest, UnifiedFullViewingKey, UnifiedSpendingKey},
};

use ::sapling::zip32::ExtendedFullViewingKey;
Expand All @@ -338,9 +338,7 @@ mod tests {
zip32::AccountId,
};

use crate::{
testing::TestBuilder, wallet::scanning::priority_code, WalletDb, DEFAULT_UA_REQUEST,
};
use crate::{testing::TestBuilder, wallet::scanning::priority_code, WalletDb, UA_TRANSPARENT};

use super::init_wallet_db;

Expand Down Expand Up @@ -1360,8 +1358,12 @@ mod tests {
)?;

let ufvk_str = ufvk.encode(&wdb.params);

// Unified addresses at the time of the addition of migrations did not contain an
// Orchard component.
let ua_request = UnifiedAddressRequest::unsafe_new(false, true, UA_TRANSPARENT);
let address_str = Address::Unified(
ufvk.default_address(DEFAULT_UA_REQUEST)
ufvk.default_address(ua_request)
.expect("A valid default address exists for the UFVK")
.0,
)
Expand All @@ -1381,7 +1383,7 @@ mod tests {
{
let taddr = Address::Transparent(
*ufvk
.default_address(DEFAULT_UA_REQUEST)
.default_address(ua_request)
.expect("A valid default address exists for the UFVK")
.0
.transparent()
Expand Down Expand Up @@ -1482,10 +1484,13 @@ mod tests {
assert_eq!(DiversifierIndex::from(tv.diversifier_index), di);
assert_eq!(tvua.transparent(), ua.transparent());
assert_eq!(tvua.sapling(), ua.sapling());
#[cfg(not(feature = "orchard"))]
assert_eq!(tv.unified_addr, ua.encode(&Network::MainNetwork));

// hardcoded with knowledge of what's coming next
let ua_request = UnifiedAddressRequest::unsafe_new(false, true, true);
db_data
.get_next_available_address(account_id, DEFAULT_UA_REQUEST)
.get_next_available_address(account_id, ua_request)
.unwrap()
.expect("get_next_available_address generated an address");
} else {
Expand Down

0 comments on commit 6f1e4af

Please sign in to comment.