From 879915e086529664a1446f3370bcbc2eb11c8350 Mon Sep 17 00:00:00 2001 From: Hitenjain14 Date: Sun, 27 Aug 2023 01:02:28 +0530 Subject: [PATCH] fix delete change --- code/go/0chain.net/blobbercore/allocation/connection.go | 2 ++ code/go/0chain.net/blobbercore/handler/file_command_delete.go | 1 + 2 files changed, 3 insertions(+) diff --git a/code/go/0chain.net/blobbercore/allocation/connection.go b/code/go/0chain.net/blobbercore/allocation/connection.go index 85965510b..73d4ba03c 100644 --- a/code/go/0chain.net/blobbercore/allocation/connection.go +++ b/code/go/0chain.net/blobbercore/allocation/connection.go @@ -127,9 +127,11 @@ func SendCommand(connectionID, pathHash string, cmd FileCommand) error { } connChange := connectionProcessor[connectionID].changes[pathHash] if connChange == nil { + connectionObjMutex.RUnlock() return common.NewError("connection_change_not_found", "connection change not found") } if connChange.isFinalized { + connectionObjMutex.RUnlock() return common.NewError("connection_change_finalized", "connection change finalized") } connectionObjMutex.RUnlock() diff --git a/code/go/0chain.net/blobbercore/handler/file_command_delete.go b/code/go/0chain.net/blobbercore/handler/file_command_delete.go index 7b048309a..47902a65d 100644 --- a/code/go/0chain.net/blobbercore/handler/file_command_delete.go +++ b/code/go/0chain.net/blobbercore/handler/file_command_delete.go @@ -86,6 +86,7 @@ func (cmd *DeleteFileCommand) ProcessContent(allocationObj *allocation.Allocatio result.ValidationRoot = cmd.existingFileRef.ValidationRoot result.FixedMerkleRoot = cmd.existingFileRef.FixedMerkleRoot result.Size = cmd.existingFileRef.Size + result.IsFinal = true cmd.allocationChange = &allocation.AllocationChange{} cmd.allocationChange.ConnectionID = connectionID