Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions code/go/0chain.net/blobbercore/allocation/protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
"encoding/json"
"errors"
"fmt"

"github.com/0chain/blobber/code/go/0chain.net/blobbercore/datastore"
"github.com/0chain/blobber/code/go/0chain.net/core/chain"
"github.com/0chain/blobber/code/go/0chain.net/core/common"
. "github.com/0chain/blobber/code/go/0chain.net/core/logging"
"github.com/0chain/blobber/code/go/0chain.net/core/node"
"github.com/0chain/blobber/code/go/0chain.net/core/transaction"
"go.uber.org/zap"
"gorm.io/gorm"
)

Expand Down Expand Up @@ -94,16 +94,22 @@ func VerifyAllocationTransaction(ctx context.Context, allocationTx string, reado

isExist = (a.ID != "")

Logger.Info("VerifyAllocationTransaction",
zap.Bool("isExist", isExist),
zap.Any("allocation", a),
zap.Any("storageAllocation", sa),
zap.String("node.Self.ID", node.Self.ID))

if !isExist {
foundBlobber := false
for _, blobberConnection := range sa.Blobbers {
if blobberConnection.ID != node.Self.ID {
for _, blobberConnection := range sa.BlobberDetails {
if blobberConnection.BlobberID != node.Self.ID {
continue
}
foundBlobber = true
a.AllocationRoot = ""
a.BlobberSize = (sa.Size + int64(len(sa.Blobbers)-1)) /
int64(len(sa.Blobbers))
a.BlobberSize = (sa.Size + int64(len(sa.BlobberDetails)-1)) /
int64(len(sa.BlobberDetails))
a.BlobberSizeUsed = 0
break
}
Expand Down
8 changes: 4 additions & 4 deletions code/go/0chain.net/blobbercore/allocation/zcn.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func SyncAllocation(allocationTx string) (*Allocation, error) {
alloc := &Allocation{}

belongToThisBlobber := false
for _, blobberConnection := range sa.Blobbers {
if blobberConnection.ID == node.Self.ID {
for _, blobberConnection := range sa.BlobberDetails {
if blobberConnection.BlobberID == node.Self.ID {
belongToThisBlobber = true

alloc.AllocationRoot = ""
alloc.BlobberSize = (sa.Size + int64(len(sa.Blobbers)-1)) /
int64(len(sa.Blobbers))
alloc.BlobberSize = (sa.Size + int64(len(sa.BlobberDetails)-1)) /
int64(len(sa.BlobberDetails))
alloc.BlobberSizeUsed = 0

break
Expand Down
1 change: 0 additions & 1 deletion code/go/0chain.net/core/transaction/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ type StorageAllocation struct {
Size int64 `json:"size"`
UsedSize int64 `json:"used_size"`
Expiration common.Timestamp `json:"expiration_date"`
Blobbers []*StorageNode `json:"blobbers"`
BlobberDetails []*BlobberAllocation `json:"blobber_details"`
Finalized bool `json:"finalized"`
CCT time.Duration `json:"challenge_completion_time"`
Expand Down