Fixes for handling authority expiry queue (#40)
All checks were successful
Integration Tests / test-integration (push) Successful in 3m2s
E2E Tests / test-e2e (push) Successful in 4m29s
Unit Tests / test-unit (push) Successful in 2m8s
Publish on release / Run docker build and publish (release) Successful in 2m50s
SDK Tests / sdk_tests_nameservice_expiry (push) Successful in 8m52s
SDK Tests / sdk_tests (push) Successful in 10m7s
SDK Tests / sdk_tests_auctions (push) Successful in 14m13s

Part of #38

Reviewed-on: cerc-io/laconic2d#40
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
Prathamesh Musale 2024-07-22 05:40:45 +00:00 committed by ashwin
parent 43b675cc0a
commit eb20f77e83
2 changed files with 8 additions and 2 deletions

View File

@ -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

View File

@ -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.