Skip to content

Commit

Permalink
fix: failed to calculate datacap
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Jul 11, 2024
1 parent 5b807ad commit 2519712
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/droplet-client/storage_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ var batchStorageDealInitV2 = &cli.Command{
m.pieceSize = paddedPieceSize.Unpadded()
}

dcap = big.NewInt(0).Sub(dcap, big.NewInt(int64(paddedPieceSize)).Int)
if dcap.Cmp(big.NewInt(0).Int) < 0 {
fmt.Printf("not enough datacap to create deal: %v\n", dcap)
remainDcap := big.NewInt(0).Sub(dcap, big.NewInt(int64(paddedPieceSize)).Int)
if remainDcap.Cmp(big.NewInt(0).Int) < 0 {
fmt.Printf("not enough datacap to create deal: %v\n", remainDcap)
break
}

Expand All @@ -517,6 +517,7 @@ var batchStorageDealInitV2 = &cli.Command{
continue
}
idx++
dcap = remainDcap
fmt.Println("created deal", dealUUID, ", piece cid", m.pieceCID)

_ = writer.Write([]string{dealUUID.String(), params.provider.String(), params.from.String(),
Expand Down

0 comments on commit 2519712

Please sign in to comment.