Skip to content

Commit

Permalink
DRYing
Browse files Browse the repository at this point in the history
  • Loading branch information
fluidvanadium committed May 28, 2024
1 parent 160ff52 commit 0a083a0
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions zingolib/src/wallet/transaction_records_by_id/trait_inputsource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,30 +167,22 @@ impl InputSource for TransactionRecordsById {
let transaction = self.get(id.txid());
let output_index = id.output_index() as u32;
match id.protocol() {
zcash_client_backend::ShieldedProtocol::Sapling => {
match transaction.and_then(|transaction_record| {
zcash_client_backend::ShieldedProtocol::Sapling => transaction
.and_then(|transaction_record| {
transaction_record.get_received_note::<SaplingDomain>(output_index)
}) {
Some(received_note) => {
selected_sapling.push(received_note);
Ok(())
}
None => Err(()),
}
}
zcash_client_backend::ShieldedProtocol::Orchard => {
match transaction.and_then(|transaction_record| {
})
.map(|received_note| {
selected_sapling.push(received_note);
}),
zcash_client_backend::ShieldedProtocol::Orchard => transaction
.and_then(|transaction_record| {
transaction_record.get_received_note::<OrchardDomain>(output_index)
}) {
Some(received_note) => {
selected_orchard.push(received_note);
Ok(())
}
None => Err(()),
}
}
})
.map(|received_note| {
selected_orchard.push(received_note);
}),
}
.map_err(|()| InputSourceError::NoteCannotBeIdentified(*id))
.ok_or(InputSourceError::NoteCannotBeIdentified(*id))
})?;

Ok(SpendableNotes::new(selected_sapling, selected_orchard))
Expand Down

0 comments on commit 0a083a0

Please sign in to comment.