Skip to content

Commit

Permalink
zcash_client_sqlite: Ensure that we only exclude the correct notes fr…
Browse files Browse the repository at this point in the history
…om selection.
  • Loading branch information
nuttycom authored and str4d committed Mar 10, 2024
1 parent a9c2d77 commit a017717
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion zcash_client_sqlite/src/wallet/orchard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,10 @@ pub(crate) fn select_spendable_orchard_notes<P: consensus::Parameters>(
FROM (SELECT * from eligible WHERE so_far >= :target_value LIMIT 1)",
)?;

let excluded: Vec<Value> = exclude.iter().map(|n| Value::from(n.1)).collect();
let excluded: Vec<Value> = exclude
.iter()
.filter_map(|n| matches!(n.0, ShieldedProtocol::Orchard).then(|| Value::from(n.1)))
.collect();
let excluded_ptr = Rc::new(excluded);

let notes = stmt_select_notes.query_and_then(
Expand Down
5 changes: 4 additions & 1 deletion zcash_client_sqlite/src/wallet/sapling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,10 @@ pub(crate) fn select_spendable_sapling_notes<P: consensus::Parameters>(
FROM (SELECT * from eligible WHERE so_far >= :target_value LIMIT 1)",
)?;

let excluded: Vec<Value> = exclude.iter().map(|n| Value::from(n.1)).collect();
let excluded: Vec<Value> = exclude
.iter()
.filter_map(|n| matches!(n.0, ShieldedProtocol::Sapling).then(|| Value::from(n.1)))
.collect();
let excluded_ptr = Rc::new(excluded);

let notes = stmt_select_notes.query_and_then(
Expand Down

0 comments on commit a017717

Please sign in to comment.