From eb20f77e83fe2de8ec67cea0613e97c11a4932f1 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Mon, 22 Jul 2024 05:40:45 +0000 Subject: [PATCH] Fixes for handling authority expiry queue (#40) Part of #38 Reviewed-on: https://git.vdb.to/cerc-io/laconic2d/pulls/40 Co-authored-by: Prathamesh Musale Co-committed-by: Prathamesh Musale --- x/registry/keeper/naming_keeper.go | 5 +++-- x/registry/keeper/record_keeper.go | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/x/registry/keeper/naming_keeper.go b/x/registry/keeper/naming_keeper.go index 38f5844e8..a810ad713 100644 --- a/x/registry/keeper/naming_keeper.go +++ b/x/registry/keeper/naming_keeper.go @@ -519,7 +519,8 @@ func (k Keeper) ProcessAuthorityExpiryQueue(ctx sdk.Context) error { k.Logger(ctx).Info(fmt.Sprintf("Marking authority expired as no bond present: %s", name)) - return nil + // Continue with the loop + continue } // Try to renew the authority by taking rent. @@ -585,7 +586,7 @@ func (k Keeper) deleteAuthorityExpiryQueue(ctx sdk.Context, name string, authori } } - if len(existingNamesList.Value) == 0 { + if len(newNamesSlice) == 0 { return k.AuthorityExpiryQueue.Remove(ctx, expiryTime) } else { existingNamesList.Value = newNamesSlice diff --git a/x/registry/keeper/record_keeper.go b/x/registry/keeper/record_keeper.go index e6fb26381..db5d71c97 100644 --- a/x/registry/keeper/record_keeper.go +++ b/x/registry/keeper/record_keeper.go @@ -111,6 +111,11 @@ func (rk RecordKeeper) OnAuctionWinnerSelected(ctx sdk.Context, auctionId string // Mark as expired. authority.Status = registrytypes.AuthorityExpired logger(ctx).Info(fmt.Sprintf("No winner, marking authority as expired: %s", name)) + + logger(ctx).Info(fmt.Sprintf("Deleting the expiry queue entry: %s", name)) + if err = rk.k.deleteAuthorityExpiryQueue(ctx, name, authority); err != nil { + logger(ctx).Error("Unable to delete expiry queue entry", err) + } } // Forget about this auction now, we no longer need it.