Skip to content
Snippets Groups Projects

Resolve "smithMembers.expiresOn is only growing"

Merged Hugo Trentesaux requested to merge 276-smithmembers-expireson-is-only-growing into master
2 files
+ 50
5
Compare changes
  • Side-by-side
  • Inline

Files

+ 8
5
@@ -240,10 +240,13 @@ pub mod pallet {
@@ -240,10 +240,13 @@ pub mod pallet {
received_certs: issuers_,
received_certs: issuers_,
},
},
);
);
ExpiresOn::<T>::append(
// if smith is offline, schedule expire
CurrentSession::<T>::get() + T::SmithInactivityMaxDuration::get(),
if !*is_online {
receiver,
ExpiresOn::<T>::append(
);
CurrentSession::<T>::get() + T::SmithInactivityMaxDuration::get(),
 
receiver,
 
);
 
}
}
}
for (issuer, issued_certs) in cert_meta_by_issuer {
for (issuer, issued_certs) in cert_meta_by_issuer {
@@ -516,7 +519,7 @@ impl<T: Config> Pallet<T> {
@@ -516,7 +519,7 @@ impl<T: Config> Pallet<T> {
/// Handle the removal of Smiths whose expiration time has been reached at a given session index.
/// Handle the removal of Smiths whose expiration time has been reached at a given session index.
fn on_exclude_expired_smiths(at: SessionIndex) {
fn on_exclude_expired_smiths(at: SessionIndex) {
if let Some(smiths_to_remove) = ExpiresOn::<T>::get(at) {
if let Some(smiths_to_remove) = ExpiresOn::<T>::take(at) {
for smith in smiths_to_remove {
for smith in smiths_to_remove {
if let Some(smith_meta) = Smiths::<T>::get(smith) {
if let Some(smith_meta) = Smiths::<T>::get(smith) {
if let Some(expires_on) = smith_meta.expires_on {
if let Some(expires_on) = smith_meta.expires_on {
Loading