Skip to content

Commit

Permalink
cli: fix empty block uploading in util upload-bin
Browse files Browse the repository at this point in the history
In case of uploading retry already drained bin buffer is returned in
`bw.Bytes`, which leads to empty block uploading.

Close #3630

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Oct 21, 2024
1 parent 29bb3ff commit e332c15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cli/util/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ func uploadBin(ctx *cli.Context) error {
*object.NewAttribute("prevHash", blk.PrevHash.StringLE()),
*object.NewAttribute("timestamp", strconv.FormatUint(blk.Timestamp, 10)),
}

objBytes := bw.Bytes()

Check warning on line 166 in cli/util/uploader.go

View check run for this annotation

Codecov / codecov/patch

cli/util/uploader.go#L166

Added line #L166 was not covered by tests
err = retry(func() error {
return uploadObj(ctx.Context, p, signer, acc.PrivateKey().GetScriptHash(), containerID, bw.Bytes(), attrs, homomorphicHashingDisabled)
return uploadObj(ctx.Context, p, signer, acc.PrivateKey().GetScriptHash(), containerID, objBytes, attrs, homomorphicHashingDisabled)

Check warning on line 168 in cli/util/uploader.go

View check run for this annotation

Codecov / codecov/patch

cli/util/uploader.go#L168

Added line #L168 was not covered by tests
})
if err != nil {
select {
Expand Down

0 comments on commit e332c15

Please sign in to comment.