Skip to content

Commit

Permalink
add check for nil marker and 0 chain size
Browse files Browse the repository at this point in the history
  • Loading branch information
Hitenjain14 committed Nov 17, 2024
1 parent 06b30e2 commit 46d3da0
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 46d3da0

Please sign in to comment.