Skip to content

Commit

Permalink
use auto error conversion for verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldjeffrey committed Dec 20, 2024
1 parent a86431f commit d50f84e
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions iot_packet_verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ where
let payer = self
.config_server
.fetch_org(report.oui, &mut org_cache)
.await
.map_err(VerificationError::ConfigError)?;
.await?;

if let Some(remaining_balance) = self
.debiter
Expand All @@ -85,8 +84,7 @@ where
{
pending_burns
.add_burned_amount(&payer, debit_amount)
.await
.map_err(VerificationError::BurnError)?;
.await?;

valid_packets
.write(ValidPacket {
Expand All @@ -100,10 +98,7 @@ where
.map_err(VerificationError::ValidPacketWriterError)?;

if remaining_balance < minimum_allowed_balance {
self.config_server
.disable_org(report.oui)
.await
.map_err(VerificationError::ConfigError)?;
self.config_server.disable_org(report.oui).await?;
}
} else {
invalid_packets
Expand All @@ -115,10 +110,8 @@ where
})
.await
.map_err(VerificationError::InvalidPacketWriterError)?;
self.config_server
.disable_org(report.oui)
.await
.map_err(VerificationError::ConfigError)?;

self.config_server.disable_org(report.oui).await?;
}
}

Expand Down

0 comments on commit d50f84e

Please sign in to comment.