Skip to content

Commit

Permalink
Remove network_type calls that are obviated by the blanket impl.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttycom committed Mar 5, 2024
1 parent a8d7a0a commit f58ea89
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 25 deletions.
17 changes: 6 additions & 11 deletions components/zcash_protocol/src/local_consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,30 +198,25 @@ mod tests {
z_future: Some(expected_z_future),
};

assert_eq!(regtest.coin_type(), constants::regtest::COIN_TYPE);
assert_eq!(
regtest.network_type().coin_type(),
constants::regtest::COIN_TYPE
);
assert_eq!(
regtest.network_type().hrp_sapling_extended_spending_key(),
regtest.hrp_sapling_extended_spending_key(),
constants::regtest::HRP_SAPLING_EXTENDED_SPENDING_KEY
);
assert_eq!(
regtest
.network_type()
.hrp_sapling_extended_full_viewing_key(),
regtest.hrp_sapling_extended_full_viewing_key(),
constants::regtest::HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY
);
assert_eq!(
regtest.network_type().hrp_sapling_payment_address(),
regtest.hrp_sapling_payment_address(),
constants::regtest::HRP_SAPLING_PAYMENT_ADDRESS
);
assert_eq!(
regtest.network_type().b58_pubkey_address_prefix(),
regtest.b58_pubkey_address_prefix(),
constants::regtest::B58_PUBKEY_ADDRESS_PREFIX
);
assert_eq!(
regtest.network_type().b58_script_address_prefix(),
regtest.b58_script_address_prefix(),
constants::regtest::B58_SCRIPT_ADDRESS_PREFIX
);
}
Expand Down
18 changes: 6 additions & 12 deletions zcash_client_sqlite/src/wallet/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,13 +712,11 @@ mod tests {
)?;

let address = encode_payment_address(
wdb.params.network_type().hrp_sapling_payment_address(),
wdb.params.hrp_sapling_payment_address(),
&extfvk.default_address().1,
);
let extfvk = encode_extended_full_viewing_key(
wdb.params
.network_type()
.hrp_sapling_extended_full_viewing_key(),
wdb.params.hrp_sapling_extended_full_viewing_key(),
extfvk,
);
wdb.conn.execute(
Expand All @@ -739,8 +737,7 @@ mod tests {

let seed = [0xab; 32];
let account = AccountId::ZERO;
let secret_key =
sapling::spending_key(&seed, db_data.params.network_type().coin_type(), account);
let secret_key = sapling::spending_key(&seed, db_data.params.coin_type(), account);
let extfvk = secret_key.to_extended_full_viewing_key();

init_0_3_0(&mut db_data, &extfvk, account).unwrap();
Expand Down Expand Up @@ -852,13 +849,11 @@ mod tests {
)?;

let address = encode_payment_address(
wdb.params.network_type().hrp_sapling_payment_address(),
wdb.params.hrp_sapling_payment_address(),
&extfvk.default_address().1,
);
let extfvk = encode_extended_full_viewing_key(
wdb.params
.network_type()
.hrp_sapling_extended_full_viewing_key(),
wdb.params.hrp_sapling_extended_full_viewing_key(),
extfvk,
);
wdb.conn.execute(
Expand Down Expand Up @@ -913,8 +908,7 @@ mod tests {

let seed = [0xab; 32];
let account = AccountId::ZERO;
let secret_key =
sapling::spending_key(&seed, db_data.params.network_type().coin_type(), account);
let secret_key = sapling::spending_key(&seed, db_data.params.coin_type(), account);
let extfvk = secret_key.to_extended_full_viewing_key();

init_autoshielding(&mut db_data, &extfvk, account).unwrap();
Expand Down
4 changes: 2 additions & 2 deletions zcash_keys/src/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ impl UnifiedSpendingKey {
transparent: legacy::AccountPrivKey::from_seed(_params, seed, _account)
.map_err(DerivationError::Transparent)?,
#[cfg(feature = "sapling")]
sapling: sapling::spending_key(seed, _params.network_type().coin_type(), _account),
sapling: sapling::spending_key(seed, _params.coin_type(), _account),
#[cfg(feature = "orchard")]
orchard: orchard::keys::SpendingKey::from_zip32_seed(
seed,
_params.network_type().coin_type(),
_params.coin_type(),
_account,
)
.map_err(DerivationError::Orchard)?,
Expand Down

0 comments on commit f58ea89

Please sign in to comment.