Skip to content

Commit

Permalink
zcash_client_sqlite: Fix incorrect input selection filtering when sen…
Browse files Browse the repository at this point in the history
…ding to transparent.

The "avoid pool crossing" conditions in not selection were erroneously
not taking into account the need to pay transparent outputs.
  • Loading branch information
nuttycom committed Mar 27, 2024
1 parent 0d80f3c commit 6bda59f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions zcash_client_backend/src/data_api/wallet/input_selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,11 +403,13 @@ where
#[cfg(not(feature = "orchard"))]
let orchard_input_total = NonNegativeAmount::ZERO;

let use_sapling =
!(sapling_outputs.is_empty() && orchard_input_total >= amount_required);
// Use Sapling inputs if there are no Orchard outputs or there are not sufficient
// Orchard outputs to cover the amount required.
let use_sapling = orchard_outputs.is_empty() || amount_required > orchard_input_total;

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

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

cannot find value `orchard_outputs` in this scope

error[E0425]: cannot find value `orchard_outputs` in this scope --> zcash_client_backend/src/data_api/wallet/input_selection.rs:408:31 | 408 | let use_sapling = orchard_outputs.is_empty() || amount_required > orchard_input_total; | ^^^^^^^^^^^^^^^ not found in this scope

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

View workflow job for this annotation

GitHub Actions / Clippy (MSRV)

cannot find value `orchard_outputs` in this scope

error[E0425]: cannot find value `orchard_outputs` in this scope --> zcash_client_backend/src/data_api/wallet/input_selection.rs:408:31 | 408 | let use_sapling = orchard_outputs.is_empty() || amount_required > orchard_input_total; | ^^^^^^^^^^^^^^^ not found in this scope
// Use Orchard inputs if there are insufficient Sapling funds to cover the amount
// reqiuired.
#[cfg(feature = "orchard")]
let use_orchard =
!(orchard_outputs.is_empty() && sapling_input_total >= amount_required);
let use_orchard = amount_required > sapling_input_total;

let sapling_inputs = if use_sapling {
shielded_inputs
Expand Down

0 comments on commit 6bda59f

Please sign in to comment.