Skip to content
Snippets Groups Projects

fix(wot): cannot certify self

Merged Pascal Engélibert requested to merge cannot-certify-self into master
Files
2
@@ -276,6 +276,8 @@ pub mod pallet {
NotRespectRenewablePeriod,
/// This identity has already issued a certification too recently
NotRespectCertPeriod,
/// An identity cannot certify itself
CannotCertifySelf,
}
#[pallet::hooks]
@@ -342,6 +344,9 @@ pub mod pallet {
let issuer = T::IdtyIndexOf::convert(who).ok_or(Error::<T, I>::IssuerNotFound)?;
let receiver =
T::IdtyIndexOf::convert(receiver).ok_or(Error::<T, I>::ReceiverNotFound)?;
if issuer == receiver {
return Err(Error::<T, I>::CannotCertifySelf.into());
}
if !T::IsCertAllowed::is_cert_allowed(issuer, receiver) {
return Err(Error::<T, I>::CertNotAllowed.into());
}
Loading