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

fix(#176): expiration should be postponed only for Pending smiths

parent 5879b057
No related branches found
No related tags found
1 merge request!232Resolve "PromotedToSmith is issued even for Smith"
...@@ -447,11 +447,17 @@ impl<T: Config> Pallet<T> { ...@@ -447,11 +447,17 @@ impl<T: Config> Pallet<T> {
} else { } else {
SmithStatus::Pending SmithStatus::Pending
}; };
// expiry postponed
if smith_meta.status == SmithStatus::Pending {
// - postpone the expiration: a Pending smith cannot do anything but wait
// this postponement is here to ease the process of becoming a smith
let new_expires_on = let new_expires_on =
CurrentSession::<T>::get() + T::SmithInactivityMaxDuration::get(); CurrentSession::<T>::get() + T::SmithInactivityMaxDuration::get();
smith_meta.expires_on = Some(new_expires_on); smith_meta.expires_on = Some(new_expires_on);
Self::deposit_event(Event::<T>::SmithCertAdded { receiver, issuer }); // ExpiresOn::<T>::append(new_expires_on, receiver);
}
// - if the status is smith but wasn't, notify that smith gained membership
if smith_meta.status == SmithStatus::Smith && previous_status != SmithStatus::Smith if smith_meta.status == SmithStatus::Smith && previous_status != SmithStatus::Smith
{ {
Self::deposit_event(Event::<T>::SmithMembershipAdded { Self::deposit_event(Event::<T>::SmithMembershipAdded {
......
...@@ -610,7 +610,6 @@ fn certifying_an_online_smith() { ...@@ -610,7 +610,6 @@ fn certifying_an_online_smith() {
RuntimeOrigin::signed(3), RuntimeOrigin::signed(3),
5 5
)); ));
// TODO: this test currently fails because expires_on is not None
assert_eq!( assert_eq!(
Smiths::<Runtime>::get(5), Smiths::<Runtime>::get(5),
Some(SmithMeta { Some(SmithMeta {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment