From 8a5788523afcbf04e20af8b5baa4fc68783b81de Mon Sep 17 00:00:00 2001
From: cgeek <cem.moreau@gmail.com>
Date: Wed, 24 Jan 2024 12:29:18 +0100
Subject: [PATCH] fix(#176): last certification does postpone expiry

---
 pallets/smith-members/src/lib.rs   | 2 +-
 pallets/smith-members/src/tests.rs | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/pallets/smith-members/src/lib.rs b/pallets/smith-members/src/lib.rs
index 61ae03eda..bf8527957 100644
--- a/pallets/smith-members/src/lib.rs
+++ b/pallets/smith-members/src/lib.rs
@@ -455,7 +455,7 @@ impl<T: Config> Pallet<T> {
                         SmithStatus::Pending
                     };
 
-                if smith_meta.status == SmithStatus::Pending {
+                if previous_status != SmithStatus::Smith {
                     // - 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 =
diff --git a/pallets/smith-members/src/tests.rs b/pallets/smith-members/src/tests.rs
index 46430f600..3f30805ea 100644
--- a/pallets/smith-members/src/tests.rs
+++ b/pallets/smith-members/src/tests.rs
@@ -586,7 +586,6 @@ fn certifying_an_online_smith() {
             5
         ));
         // Smith can expire
-        // TODO: test failing because expires_on is not postponed to session 8
         assert_eq!(
             Smiths::<Runtime>::get(5),
             Some(SmithMeta {
-- 
GitLab