Skip to content

Commit

Permalink
chore: apply rabbit feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Oct 4, 2024
1 parent f79d240 commit 350bbf8
Showing 1 changed file with 10 additions and 17 deletions.
27 changes: 10 additions & 17 deletions packages/rs-drive-proof-verifier/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,24 +832,17 @@ impl FromProof<platform::GetDataContractsRequest> for DataContracts {
})?;

verify_tenderdash_proof(proof, mtd, &root_hash, provider)?;

let maybe_contracts: Option<DataContracts> = if !contracts.is_empty() {
let contracts: DataContracts = contracts
.into_iter()
.try_fold(DataContracts::new(), |mut acc, (k, v)| {
Identifier::from_bytes(&k).map(|id| {
acc.insert(id, v);
acc
})
let maybe_contracts = contracts
.into_iter()
.map(|(k, v)| {
Identifier::from_bytes(&k).map(|id| (id, v)).map_err(|e| {
Error::ResultEncodingError {
error: e.to_string(),
}
})
.map_err(|e| Error::ResultEncodingError {
error: e.to_string(),
})?;

Some(contracts)
} else {
None
};
})
.collect::<Result<DataContracts, Error>>()?
.into_option();

Ok((maybe_contracts, mtd.clone(), proof.clone()))
}
Expand Down

0 comments on commit 350bbf8

Please sign in to comment.