Skip to content

Commit

Permalink
remove redundant error mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck committed Jan 15, 2024
1 parent 8819867 commit c1e38ba
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions iot_verifier/src/poc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,9 +373,8 @@ impl Poc {
}

async fn verify_beacon_reciprocity(&self) -> anyhow::Result<bool> {
let last_witness = LastWitness::get(&self.pool, self.beacon_report.report.pub_key.as_ref())
.await
.map_err(anyhow::Error::from)?;
let last_witness =
LastWitness::get(&self.pool, self.beacon_report.report.pub_key.as_ref()).await?;
if let Some(last_witness) = last_witness {
if self.beacon_report.received_timestamp - last_witness.timestamp < *RECIPROCITY_WINDOW
{
Expand All @@ -386,9 +385,7 @@ impl Poc {
}

async fn verify_witness_reciprocity(&self, pubkey: &PublicKeyBinary) -> anyhow::Result<bool> {
let last_beacon = LastBeacon::get(&self.pool, pubkey.as_ref())
.await
.map_err(anyhow::Error::from)?;
let last_beacon = LastBeacon::get(&self.pool, pubkey.as_ref()).await?;
if let Some(last_beacon) = last_beacon {
if self.beacon_report.received_timestamp - last_beacon.timestamp < *RECIPROCITY_WINDOW {
return Ok(true);
Expand Down

0 comments on commit c1e38ba

Please sign in to comment.