mirror of
https://github.com/aljazceru/cdk.git
synced 2026-02-05 05:06:14 +01:00
refactor: check if token is pending during verification
This commit is contained in:
@@ -36,6 +36,8 @@ pub enum Error {
|
||||
DuplicateProofs,
|
||||
#[error("Token Spent")]
|
||||
TokenSpent,
|
||||
#[error("Token Pending")]
|
||||
TokenPending,
|
||||
#[error("`{0}`")]
|
||||
Custom(String),
|
||||
#[error("`{0}`")]
|
||||
@@ -271,13 +273,21 @@ impl<L: LocalStore> Mint<L> {
|
||||
if self
|
||||
.localstore
|
||||
.get_spent_proof(&proof.secret)
|
||||
.await
|
||||
.unwrap()
|
||||
.await?
|
||||
.is_some()
|
||||
{
|
||||
return Err(Error::TokenSpent);
|
||||
}
|
||||
|
||||
if self
|
||||
.localstore
|
||||
.get_pending_proof(&proof.secret)
|
||||
.await?
|
||||
.is_some()
|
||||
{
|
||||
return Err(Error::TokenPending);
|
||||
}
|
||||
|
||||
let keyset = self
|
||||
.localstore
|
||||
.get_keyset(&proof.keyset_id)
|
||||
|
||||
Reference in New Issue
Block a user