From 8283b9b2b8db0eb315ebd9e51b6492042992dcb0 Mon Sep 17 00:00:00 2001 From: Alexxxxxx <118710506+alexgao001@users.noreply.github.com> Date: Wed, 6 Dec 2023 10:22:49 +0800 Subject: [PATCH] fix bucket status causing event emitted (#522) --- x/storage/keeper/keeper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/storage/keeper/keeper.go b/x/storage/keeper/keeper.go index 9f068e5f4..170bb2c98 100644 --- a/x/storage/keeper/keeper.go +++ b/x/storage/keeper/keeper.go @@ -474,7 +474,7 @@ func (k Keeper) DiscontinueBucket(ctx sdk.Context, operator sdk.AccAddress, buck if count+1 > max { return types.ErrNoMoreDiscontinue.Wrapf("no more buckets can be requested in this window") } - + previousStatus := bucketInfo.BucketStatus bucketInfo.BucketStatus = types.BUCKET_STATUS_DISCONTINUED store := ctx.KVStore(k.storeKey) @@ -486,7 +486,7 @@ func (k Keeper) DiscontinueBucket(ctx sdk.Context, operator sdk.AccAddress, buck k.appendDiscontinueBucketIds(ctx, deleteAt, []sdkmath.Uint{bucketInfo.Id}) k.SetDiscontinueBucketCount(ctx, operator, count+1) - if bucketInfo.BucketStatus == types.BUCKET_STATUS_MIGRATING { + if previousStatus == types.BUCKET_STATUS_MIGRATING { if err := ctx.EventManager().EmitTypedEvents(&types.EventCancelMigrationBucket{ Operator: operator.String(), BucketName: bucketInfo.BucketName,