Skip to content
Snippets Groups Projects
Commit ac4ceede authored by Hugo Trentesaux's avatar Hugo Trentesaux
Browse files

instead of removing the identity, expire it

parent a16bd176
No related branches found
No related tags found
1 merge request!181Fix consequence of certification loss
Pipeline #33142 waiting for manual action
......@@ -365,22 +365,13 @@ impl<T: Config<I>, I: 'static> pallet_certification::traits::OnRemovedCert<IdtyI
if receiver_received_count < T::MinCertForMembership::get()
&& pallet_membership::Pallet::<T, I>::is_member(&receiver)
{
if T::IsSubWot::get() {
// expire receiver membership
// it gives him a bit of time to get back enough certs
if let Err(e) = <pallet_membership::Pallet<T, I>>::force_expire_membership(receiver)
{
if let Err(e) = <pallet_membership::Pallet<T, I>>::force_expire_membership(receiver) {
sp_std::if_std! {
println!("fail to expire membership: {:?}", e)
}
}
} else {
// Revoke receiver membership and disable his identity
Self::dispath_idty_call(pallet_identity::Call::remove_identity {
idty_index: receiver,
idty_name: None,
});
}
}
Weight::zero()
}
......
......@@ -463,9 +463,8 @@ fn test_certification_expire() {
},
));
// in consequence, since Alice has only 1/2 normal certification remaining, she looses normal membership
System::assert_has_event(RuntimeEvent::Identity(
pallet_identity::Event::IdtyRemoved { idty_index: 1 },
System::assert_has_event(RuntimeEvent::Membership(
pallet_membership::Event::MembershipExpired(1),
));
// THIS IS NOT WHAT WE WANT !!
})
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment