Skip to content

Commit

Permalink
Merge pull request #1676 from 0chain/hotfix/size-check
Browse files Browse the repository at this point in the history
Add check for nil marker and 0 chain size
  • Loading branch information
dabasov authored Nov 17, 2024
2 parents 06b30e2 + 46d3da0 commit b1a8ec2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zboxcore/sdk/commitworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ func getFormWritter(connectionID string, wmData, fileIDMetaData []byte, body *by
}

func getReferencePathV2(blobber *blockchain.StorageNode, allocationID, allocationTx, sig string, paths []string, success *bool, mu *sync.Mutex) (*wmpt.WeightedMerkleTrie, error) {
if len(paths) == 0 {
if len(paths) == 0 || blobber.LatestWM == nil || blobber.LatestWM.ChainSize == 0 {
var node wmpt.Node
if blobber.LatestWM != nil && len(blobber.LatestWM.FileMetaRoot) > 0 {
if blobber.LatestWM != nil && len(blobber.LatestWM.FileMetaRoot) > 0 && blobber.LatestWM.ChainSize > 0 {
decodedRoot, _ := hex.DecodeString(blobber.LatestWM.FileMetaRoot)
node = wmpt.NewHashNode(decodedRoot, uint64(numBlocks(blobber.LatestWM.ChainSize)))
}
Expand Down

0 comments on commit b1a8ec2

Please sign in to comment.