Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove usk_to_tkey #22

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions zcash_client_backend/src/data_api/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
use nonempty::NonEmpty;
use rand_core::OsRng;
use sapling::{
note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey},

Check failure on line 39 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused imports: `PreparedIncomingViewingKey`, `try_sapling_note_decryption`

error: unused imports: `PreparedIncomingViewingKey`, `try_sapling_note_decryption` --> zcash_client_backend/src/data_api/wallet.rs:39:23 | 39 | note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D unused-imports` implied by `-D warnings`

Check failure on line 39 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused imports: `PreparedIncomingViewingKey`, `try_sapling_note_decryption`

error: unused imports: `PreparedIncomingViewingKey`, `try_sapling_note_decryption` --> zcash_client_backend/src/data_api/wallet.rs:39:23 | 39 | note_encryption::{try_sapling_note_decryption, PreparedIncomingViewingKey}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: `-D unused-imports` implied by `-D warnings`
prover::{OutputProver, SpendProver},
};
use std::num::NonZeroU32;
Expand All @@ -45,7 +45,7 @@
use crate::{
address::Address,
data_api::{
error::Error, Account, SentTransaction, SentTransactionOutput, WalletCommitmentTrees,

Check failure on line 48 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused imports: `Recipient`, `SentTransactionOutput`, `SentTransaction`, `TransparentAddressMetadata`

error: unused imports: `Recipient`, `SentTransactionOutput`, `SentTransaction`, `TransparentAddressMetadata` --> zcash_client_backend/src/data_api/wallet.rs:48:32 | 48 | error::Error, Account, SentTransaction, SentTransactionOutput, WalletCommitmentTrees, | ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ... 55 | wallet::{Note, OvkPolicy, Recipient, TransparentAddressMetadata}, | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^

Check failure on line 48 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused imports: `Recipient`, `SentTransactionOutput`, `SentTransaction`, `TransparentAddressMetadata`

error: unused imports: `Recipient`, `SentTransactionOutput`, `SentTransaction`, `TransparentAddressMetadata` --> zcash_client_backend/src/data_api/wallet.rs:48:32 | 48 | error::Error, Account, SentTransaction, SentTransactionOutput, WalletCommitmentTrees, | ^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ... 55 | wallet::{Note, OvkPolicy, Recipient, TransparentAddressMetadata}, | ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
WalletRead, WalletWrite,
},
decrypt_transaction,
Expand All @@ -58,7 +58,7 @@
};
use zcash_primitives::transaction::{
builder::{BuildConfig, BuildResult, Builder},
components::{amount::NonNegativeAmount, sapling::zip212_enforcement},

Check failure on line 61 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused import: `sapling::zip212_enforcement`

error: unused import: `sapling::zip212_enforcement` --> zcash_client_backend/src/data_api/wallet.rs:61:45 | 61 | components::{amount::NonNegativeAmount, sapling::zip212_enforcement}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check failure on line 61 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused import: `sapling::zip212_enforcement`

error: unused import: `sapling::zip212_enforcement` --> zcash_client_backend/src/data_api/wallet.rs:61:45 | 61 | components::{amount::NonNegativeAmount, sapling::zip212_enforcement}, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
fees::{zip317::FeeError as Zip317FeeError, FeeRule, StandardFeeRule},
Transaction, TxId,
};
Expand Down Expand Up @@ -584,13 +584,13 @@
#[allow(clippy::too_many_arguments)]
#[allow(clippy::type_complexity)]
pub fn create_proposed_transactions<DbT, ParamsT, InputsErrT, FeeRuleT, N>(
wallet_db: &mut DbT,

Check failure on line 587 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `wallet_db`

error: unused variable: `wallet_db` --> zcash_client_backend/src/data_api/wallet.rs:587:5 | 587 | wallet_db: &mut DbT, | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wallet_db` | = note: `-D unused-variables` implied by `-D warnings`

Check failure on line 587 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `wallet_db`

error: unused variable: `wallet_db` --> zcash_client_backend/src/data_api/wallet.rs:587:5 | 587 | wallet_db: &mut DbT, | ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_wallet_db` | = note: `-D unused-variables` implied by `-D warnings`
params: &ParamsT,

Check failure on line 588 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `params`

error: unused variable: `params` --> zcash_client_backend/src/data_api/wallet.rs:588:5 | 588 | params: &ParamsT, | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_params`

Check failure on line 588 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `params`

error: unused variable: `params` --> zcash_client_backend/src/data_api/wallet.rs:588:5 | 588 | params: &ParamsT, | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_params`
spend_prover: &impl SpendProver,

Check failure on line 589 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `spend_prover`

error: unused variable: `spend_prover` --> zcash_client_backend/src/data_api/wallet.rs:589:5 | 589 | spend_prover: &impl SpendProver, | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_spend_prover`

Check failure on line 589 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `spend_prover`

error: unused variable: `spend_prover` --> zcash_client_backend/src/data_api/wallet.rs:589:5 | 589 | spend_prover: &impl SpendProver, | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_spend_prover`
output_prover: &impl OutputProver,

Check failure on line 590 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `output_prover`

error: unused variable: `output_prover` --> zcash_client_backend/src/data_api/wallet.rs:590:5 | 590 | output_prover: &impl OutputProver, | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_output_prover`

Check failure on line 590 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `output_prover`

error: unused variable: `output_prover` --> zcash_client_backend/src/data_api/wallet.rs:590:5 | 590 | output_prover: &impl OutputProver, | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_output_prover`
usk: &UnifiedSpendingKey,

Check failure on line 591 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `usk`

error: unused variable: `usk` --> zcash_client_backend/src/data_api/wallet.rs:591:5 | 591 | usk: &UnifiedSpendingKey, | ^^^ help: if this is intentional, prefix it with an underscore: `_usk`

Check failure on line 591 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `usk`

error: unused variable: `usk` --> zcash_client_backend/src/data_api/wallet.rs:591:5 | 591 | usk: &UnifiedSpendingKey, | ^^^ help: if this is intentional, prefix it with an underscore: `_usk`
ovk_policy: OvkPolicy,

Check failure on line 592 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `ovk_policy`

error: unused variable: `ovk_policy` --> zcash_client_backend/src/data_api/wallet.rs:592:5 | 592 | ovk_policy: OvkPolicy, | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_ovk_policy`

Check failure on line 592 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `ovk_policy`

error: unused variable: `ovk_policy` --> zcash_client_backend/src/data_api/wallet.rs:592:5 | 592 | ovk_policy: OvkPolicy, | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_ovk_policy`
proposal: &Proposal<FeeRuleT, N>,

Check failure on line 593 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `proposal`

error: unused variable: `proposal` --> zcash_client_backend/src/data_api/wallet.rs:593:5 | 593 | proposal: &Proposal<FeeRuleT, N>, | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_proposal`

Check failure on line 593 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `proposal`

error: unused variable: `proposal` --> zcash_client_backend/src/data_api/wallet.rs:593:5 | 593 | proposal: &Proposal<FeeRuleT, N>, | ^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_proposal`
) -> Result<
NonEmpty<TxId>,
Error<
Expand All @@ -606,7 +606,7 @@
FeeRuleT: FeeRule,
{
unimplemented!();
let mut step_results = Vec::with_capacity(proposal.steps().len());

Check failure on line 609 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unreachable statement

error: unreachable statement --> zcash_client_backend/src/data_api/wallet.rs:609:5 | 608 | unimplemented!(); | ---------------- any code following this expression is unreachable 609 | let mut step_results = Vec::with_capacity(proposal.steps().len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | = note: `-D unreachable-code` implied by `-D warnings`

Check failure on line 609 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unreachable statement

error: unreachable statement --> zcash_client_backend/src/data_api/wallet.rs:609:5 | 608 | unimplemented!(); | ---------------- any code following this expression is unreachable 609 | let mut step_results = Vec::with_capacity(proposal.steps().len()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unreachable statement | = note: `-D unreachable-code` implied by `-D warnings`
for step in proposal.steps() {
let step_result = calculate_proposed_transaction(
wallet_db,
Expand All @@ -620,7 +620,6 @@
&step_results,
step,
None,
None,
)?;
step_results.push((step, step_result));
}
Expand Down Expand Up @@ -648,9 +647,6 @@
min_target_height: BlockHeight,
prior_step_results: &[(&proposal::Step<N>, BuildResult)],
proposal_step: &proposal::Step<N>,
usk_to_tkey: Option<
fn(&UnifiedSpendingKey, &TransparentAddressMetadata) -> hdwallet::secp256k1::SecretKey,
>,
override_sapling_change_address: Option<sapling::PaymentAddress>,
) -> Result<
BuildResult,
Expand Down Expand Up @@ -806,7 +802,7 @@
}

#[cfg(feature = "transparent-inputs")]
let utxos_spent = {

Check failure on line 805 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `utxos_spent`

error: unused variable: `utxos_spent` --> zcash_client_backend/src/data_api/wallet.rs:805:9 | 805 | let utxos_spent = { | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_utxos_spent`

Check failure on line 805 in zcash_client_backend/src/data_api/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

unused variable: `utxos_spent`

error: unused variable: `utxos_spent` --> zcash_client_backend/src/data_api/wallet.rs:805:9 | 805 | let utxos_spent = { | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_utxos_spent`
let known_addrs = wallet_db
.get_transparent_receivers(account)
.map_err(Error::DataSource)?;
Expand All @@ -830,16 +826,10 @@
.clone()
.ok_or_else(|| Error::NoSpendingKey(addr.encode(params)))?;

let secret_key = usk_to_tkey
.map(|f| f(usk, &address_metadata))
.unwrap_or_else(|| {
usk.transparent()
.derive_secret_key(
address_metadata.scope(),
address_metadata.address_index(),
)
.unwrap()
});
let secret_key = usk
.transparent()
.derive_secret_key(address_metadata.scope(), address_metadata.address_index())
.unwrap();

utxos_spent.push(outpoint.clone());
builder.add_transparent_input(secret_key, outpoint, utxo)?;
Expand Down
Loading