Skip to content

Commit

Permalink
use max_height for unmined transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
borngraced committed Dec 5, 2024
1 parent d78f4df commit ced9107
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions zcash_extras/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ where
// 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); | ~~~~~~~~~~~~~~~~~~~~~

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

0 comments on commit ced9107

Please sign in to comment.