Merge pull request #1301 from nuttycom/fix/orchard_ua_receiver_tests

zcash_client_sqlite: Fix tests that broke with the addition of Orchard UA receivers.
This commit is contained in:
Kris Nuttycombe 2024-03-21 22:29:22 -06:00 committed by GitHub
commit c45d3aed8a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 12 additions and 7 deletions

View File

@ -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;
@ -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;
@ -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,
)
@ -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()
@ -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 {