Go ahead and clone IVKs to limit borrowing hassles.

This commit is contained in:
Kris Nuttycombe 2021-07-30 11:45:01 -06:00
parent d8bf892c72
commit c803114bf6
1 changed files with 3 additions and 3 deletions

View File

@ -364,15 +364,15 @@ impl<T: Authorization, V> Bundle<T, V> {
/// along with the index of the action from which it was derived. /// along with the index of the action from which it was derived.
pub fn decrypt_outputs_for_keys<'a>( pub fn decrypt_outputs_for_keys<'a>(
&self, &self,
keys: &[&'a IncomingViewingKey], keys: &[IncomingViewingKey],
) -> Vec<(usize, &'a IncomingViewingKey, Note, Address, [u8; 512])> { ) -> Vec<(usize, IncomingViewingKey, Note, Address, [u8; 512])> {
self.actions self.actions
.iter() .iter()
.enumerate() .enumerate()
.filter_map(|(idx, action)| { .filter_map(|(idx, action)| {
let domain = OrchardDomain::for_action(action); let domain = OrchardDomain::for_action(action);
keys.iter().find_map(move |ivk| { keys.iter().find_map(move |ivk| {
try_note_decryption(&domain, ivk, action).map(|(n, a, m)| (idx, *ivk, n, a, m)) try_note_decryption(&domain, ivk, action).map(|(n, a, m)| (idx, ivk.clone(), n, a, m))
}) })
}) })
.collect() .collect()