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:
commit
c45d3aed8a
|
@ -326,7 +326,7 @@ mod tests {
|
||||||
address::Address,
|
address::Address,
|
||||||
data_api::scanning::ScanPriority,
|
data_api::scanning::ScanPriority,
|
||||||
encoding::{encode_extended_full_viewing_key, encode_payment_address},
|
encoding::{encode_extended_full_viewing_key, encode_payment_address},
|
||||||
keys::{sapling, UnifiedFullViewingKey, UnifiedSpendingKey},
|
keys::{sapling, UnifiedAddressRequest, UnifiedFullViewingKey, UnifiedSpendingKey},
|
||||||
};
|
};
|
||||||
|
|
||||||
use ::sapling::zip32::ExtendedFullViewingKey;
|
use ::sapling::zip32::ExtendedFullViewingKey;
|
||||||
|
@ -338,9 +338,7 @@ mod tests {
|
||||||
zip32::AccountId,
|
zip32::AccountId,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{testing::TestBuilder, wallet::scanning::priority_code, WalletDb, UA_TRANSPARENT};
|
||||||
testing::TestBuilder, wallet::scanning::priority_code, WalletDb, DEFAULT_UA_REQUEST,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::init_wallet_db;
|
use super::init_wallet_db;
|
||||||
|
|
||||||
|
@ -1360,8 +1358,12 @@ mod tests {
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
let ufvk_str = ufvk.encode(&wdb.params);
|
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(
|
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")
|
.expect("A valid default address exists for the UFVK")
|
||||||
.0,
|
.0,
|
||||||
)
|
)
|
||||||
|
@ -1381,7 +1383,7 @@ mod tests {
|
||||||
{
|
{
|
||||||
let taddr = Address::Transparent(
|
let taddr = Address::Transparent(
|
||||||
*ufvk
|
*ufvk
|
||||||
.default_address(DEFAULT_UA_REQUEST)
|
.default_address(ua_request)
|
||||||
.expect("A valid default address exists for the UFVK")
|
.expect("A valid default address exists for the UFVK")
|
||||||
.0
|
.0
|
||||||
.transparent()
|
.transparent()
|
||||||
|
@ -1482,10 +1484,13 @@ mod tests {
|
||||||
assert_eq!(DiversifierIndex::from(tv.diversifier_index), di);
|
assert_eq!(DiversifierIndex::from(tv.diversifier_index), di);
|
||||||
assert_eq!(tvua.transparent(), ua.transparent());
|
assert_eq!(tvua.transparent(), ua.transparent());
|
||||||
assert_eq!(tvua.sapling(), ua.sapling());
|
assert_eq!(tvua.sapling(), ua.sapling());
|
||||||
|
#[cfg(not(feature = "orchard"))]
|
||||||
assert_eq!(tv.unified_addr, ua.encode(&Network::MainNetwork));
|
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
|
db_data
|
||||||
.get_next_available_address(account_id, DEFAULT_UA_REQUEST)
|
.get_next_available_address(account_id, ua_request)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.expect("get_next_available_address generated an address");
|
.expect("get_next_available_address generated an address");
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue