cli: fix empty block uploading in util upload-bin

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 <ekt@morphbits.io>
This commit is contained in:
Ekaterina Pavlova 2024-10-21 17:56:40 +03:00
parent 29bb3ff1cf
commit e00d7fec7f

View file

@ -164,8 +164,9 @@ func uploadBin(ctx *cli.Context) error {
*object.NewAttribute("timestamp", strconv.FormatUint(blk.Timestamp, 10)), *object.NewAttribute("timestamp", strconv.FormatUint(blk.Timestamp, 10)),
} }
objBytes := bw.Bytes()
err = retry(func() error { 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)
}) })
if err != nil { if err != nil {
select { select {