Skip to content

Commit

Permalink
Merge pull request #586 from alexgao001/fix-discontinue-unlock-shadow…
Browse files Browse the repository at this point in the history
…object

fix: unlock shadow-object balance when a bucket is force deleted
  • Loading branch information
forcodedancing authored Mar 8, 2024
2 parents 28d5110 + 03c9062 commit 98f40b7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions x/storage/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,15 @@ func (k Keeper) ForceDeleteBucket(ctx sdk.Context, bucketId sdkmath.Uint, cap ui
return false, deleted, err
}
k.SetInternalBucketInfo(ctx, bucketInfo.Id, internalBucketInfo)

// if an object is updating, also need to unlock the shadowObject fee
if objectInfo.IsUpdating {
shadowObjectInfo := k.MustGetShadowObjectInfo(ctx, bucketInfo.BucketName, objectInfo.ObjectName)
err = k.UnlockShadowObjectFeeAndDeleteShadowObjectInfo(ctx, bucketInfo, shadowObjectInfo, objectInfo.ObjectName)
if err != nil {
return false, deleted, err
}
}
}
if err := k.doDeleteObject(ctx, spOperatorAddr, bucketInfo, &objectInfo); err != nil {
ctx.Logger().Error("do delete object err", "err", err)
Expand Down

0 comments on commit 98f40b7

Please sign in to comment.