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

fix unconfirmed change note tracking in transactions #10

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
10 changes: 6 additions & 4 deletions zcash_extras/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use std::fmt::{Debug, Display};

use zcash_primitives::{
consensus::{self, BranchId, NetworkUpgrade},

Check warning on line 5 in zcash_extras/src/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (nightly)

unused import: `NetworkUpgrade`

warning: unused import: `NetworkUpgrade` --> zcash_extras/src/wallet.rs:5:33 | 5 | consensus::{self, BranchId, NetworkUpgrade}, | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default

Check warning on line 5 in zcash_extras/src/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (nightly)

unused import: `NetworkUpgrade`

warning: unused import: `NetworkUpgrade` --> zcash_extras/src/wallet.rs:5:33 | 5 | consensus::{self, BranchId, NetworkUpgrade}, | ^^^^^^^^^^^^^^ | = note: `#[warn(unused_imports)]` on by default
memo::MemoBytes,
sapling::prover::TxProver,
transaction::{
Expand Down Expand Up @@ -36,13 +36,15 @@
// Fetch the ExtendedFullViewingKeys we are tracking
let extfvks = data.get_extended_full_viewing_keys().await?;

let max_height = data.block_height_extrema().await?.map(|(_, max)| max + 1);
let max_height = data
.block_height_extrema()
.await?
.map(|(_, max)| max + 1)
.ok_or(Error::ScanRequired)?;
let height = data
.get_tx_height(tx.txid())
.await?
.or(max_height)
.or_else(|| params.activation_height(NetworkUpgrade::Sapling))
.ok_or(Error::SaplingNotActive)?;
.unwrap_or_else(|| max_height);

Check warning on line 47 in zcash_extras/src/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (nightly)

unnecessary closure used to substitute value for `Option::None`

warning: unnecessary closure used to substitute value for `Option::None` --> zcash_extras/src/wallet.rs:44:18 | 44 | let height = data | __________________^ 45 | | .get_tx_height(tx.txid()) 46 | | .await? 47 | | .unwrap_or_else(|| max_height); | |______________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations = note: `-W clippy::unnecessary-lazy-evaluations` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_lazy_evaluations)]` help: use `unwrap_or` instead | 47 | .unwrap_or(max_height); | ~~~~~~~~~~~~~~~~~~~~~

Check warning on line 47 in zcash_extras/src/wallet.rs

View workflow job for this annotation

GitHub Actions / Clippy (nightly)

unnecessary closure used to substitute value for `Option::None`

warning: unnecessary closure used to substitute value for `Option::None` --> zcash_extras/src/wallet.rs:44:18 | 44 | let height = data | __________________^ 45 | | .get_tx_height(tx.txid()) 46 | | .await? 47 | | .unwrap_or_else(|| max_height); | |______________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations = note: `-W clippy::unnecessary-lazy-evaluations` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_lazy_evaluations)]` help: use `unwrap_or` instead | 47 | .unwrap_or(max_height); | ~~~~~~~~~~~~~~~~~~~~~
shamardy marked this conversation as resolved.
Show resolved Hide resolved

let outputs = decrypt_transaction(params, height, tx, &extfvks);
if outputs.is_empty() {
Expand Down
Loading