diff --git a/src/new_index/schema.rs b/src/new_index/schema.rs index e66187cc..306a48a8 100644 --- a/src/new_index/schema.rs +++ b/src/new_index/schema.rs @@ -1083,16 +1083,15 @@ fn get_previous_txos(block_entries: &[BlockEntry]) -> BTreeSet { #[instrument(skip_all, name = "schema::lookup_txos")] fn lookup_txos(txstore_db: &DB, outpoints: BTreeSet) -> Result> { let keys = outpoints.iter().map(TxOutRow::key).collect::>(); - let mut remain_outpoints = outpoints.into_iter(); txstore_db .multi_get(keys) .into_iter() - .map(|res| { - let outpoint = remain_outpoints.next().unwrap(); - match res.unwrap() { - Some(txo) => Ok((outpoint, deserialize(&txo).expect("failed to parse TxOut"))), - None => Err(format!("missing txo {}", outpoint).into()), - } + .zip(outpoints) + .map(|(res, outpoint)| { + let txo = res + .unwrap() + .ok_or_else(|| format!("missing txo {}", outpoint))?; + Ok((outpoint, deserialize(&txo).expect("failed to parse TxOut"))) }) .collect() }