From 28be5a8acee4ea036d34d6226230a51e9c74f8f4 Mon Sep 17 00:00:00 2001 From: zer0 Date: Tue, 10 Sep 2024 01:05:42 +0200 Subject: [PATCH] rusk-wallet: change `try_input_notes` with `pick_notes` --- rusk-wallet/src/clients.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/rusk-wallet/src/clients.rs b/rusk-wallet/src/clients.rs index 4c1a7ff9f9..290389e703 100644 --- a/rusk-wallet/src/clients.rs +++ b/rusk-wallet/src/clients.rs @@ -11,11 +11,14 @@ use execution_core::{ transfer::{phoenix::Prove, Transaction}, Error as ExecutionCoreError, }; + +use execution_core::transfer::phoenix::{Note, NoteLeaf}; + use flume::Receiver; use tokio::time::{sleep, Duration}; use wallet_core::{ - input::try_input_notes, keys::{derive_phoenix_pk, derive_phoenix_sk, derive_phoenix_vk}, + pick_notes, }; use zeroize::Zeroize; @@ -194,19 +197,19 @@ impl State { .into_iter() .map(|data| { let note = data.note; - let nullifiers = note.gen_nullifier(&sk); - let value = note.value(Some(&vk)).unwrap(); - - Ok((note, value, nullifiers)) + let block_height = data.height; + let nullifier = note.gen_nullifier(&sk); + let leaf = NoteLeaf { note, block_height }; + Ok((nullifier, leaf)) }) .collect(); - let inputs = try_input_notes(inputs?, target) + let inputs = pick_notes(&vk, inputs?.into(), target) .into_iter() - .map(|(note, scalar)| { - let opening = self.fetch_opening(¬e)?; + .map(|(scalar, note)| { + let opening = self.fetch_opening(note.as_ref())?; - Ok((note, opening, scalar)) + Ok((note.note.clone(), opening, *scalar)) }) .collect();