Skip to content
Snippets Groups Projects
Commit b2927590 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

fix(#176): avoid emitting SmithMembershipAdded twice

parent 994e6b61
No related branches found
No related tags found
No related merge requests found
Pipeline #35566 failed
......@@ -440,6 +440,7 @@ impl<T: Config> Pallet<T> {
if let Some(smith_meta) = maybe_smith_meta {
smith_meta.received_certs.push(issuer);
smith_meta.received_certs.sort();
let previous_status = smith_meta.status.clone();
smith_meta.status =
if smith_meta.received_certs.len() >= T::MinCertForMembership::get() as usize {
SmithStatus::Smith
......@@ -451,7 +452,8 @@ impl<T: Config> Pallet<T> {
CurrentSession::<T>::get() + T::SmithInactivityMaxDuration::get();
smith_meta.expires_on = Some(new_expires_on);
Self::deposit_event(Event::<T>::SmithCertAdded { receiver, issuer });
if smith_meta.status == SmithStatus::Smith {
if smith_meta.status == SmithStatus::Smith && previous_status != SmithStatus::Smith
{
Self::deposit_event(Event::<T>::SmithMembershipAdded {
idty_index: receiver,
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment