Skip to content

Commit

Permalink
Merge pull request #1485 from 0chain/issue_1482
Browse files Browse the repository at this point in the history
Remove re-fetch of same blobber in commit_connection
  • Loading branch information
ssardana08 committed Jul 8, 2022
2 parents 7295419 + e7654c4 commit 2d9bcde
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions code/go/0chain.net/smartcontract/storagesc/blobber.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,27 +642,15 @@ func (sc *StorageSmartContract) commitBlobberConnection(

blobAlloc.AllocationRoot = commitConnection.AllocationRoot
blobAlloc.LastWriteMarker = commitConnection.WriteMarker

blobAlloc.Stats.UsedSize += commitConnection.WriteMarker.Size
blobAlloc.Stats.NumWrites++

blobber.BytesWritten += commitConnection.WriteMarker.Size
blobber.SavedData += commitConnection.WriteMarker.Size

alloc.Stats.UsedSize += commitConnection.WriteMarker.Size
alloc.Stats.NumWrites++

// UpdateItem saved_data on storage node
var storageNode *StorageNode
if _, ok := alloc.BlobberAllocsMap[commitConnection.WriteMarker.BlobberID]; ok {
storageNode, err = sc.getBlobber(commitConnection.WriteMarker.BlobberID, balances)
if err != nil {
return "", common.NewError("commit_connection_failed",
"can't get blobber")
}
}

storageNode.SavedData += alloc.Stats.UsedSize

// check time boundaries
if commitConnection.WriteMarker.Timestamp < alloc.StartTime {
return "", common.NewError("commit_connection_failed",
Expand Down

0 comments on commit 2d9bcde

Please sign in to comment.