[#36] Fix needHash flag

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
Denis Kirillov 2022-08-03 12:35:43 +03:00
parent 90c1578db7
commit 1cfcf450e3
2 changed files with 4 additions and 4 deletions

2
go.mod
View file

@ -66,7 +66,7 @@ require (
github.com/nspcc-dev/hrw v1.0.9 // indirect
github.com/nspcc-dev/neofs-crypto v0.3.0 // indirect
github.com/nspcc-dev/rfc6979 v0.2.0 // indirect
github.com/nspcc-dev/tzhash v1.6.1 // indirect
github.com/nspcc-dev/tzhash v1.6.1
github.com/oklog/ulid v1.3.1 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.0.2 // indirect

View file

@ -275,12 +275,12 @@ func (a *API) formStorageGroup(ctx context.Context, cnrID cid.ID, btoken bearer.
return nil, fmt.Errorf("parse storage group members: %w", err)
}
needCalcHash, err := isHomomorphicHashingDisabled(ctx, a.pool, cnrID)
hashDisabled, err := isHomomorphicHashingDisabled(ctx, a.pool, cnrID)
if err != nil {
return nil, fmt.Errorf("check if homomorphic hash disabled: %w", err)
}
sgSize, cs, err := a.getStorageGroupSizeAndHash(ctx, cnrID, btoken, members, needCalcHash)
sgSize, cs, err := a.getStorageGroupSizeAndHash(ctx, cnrID, btoken, members, !hashDisabled)
if err != nil {
return nil, fmt.Errorf("get storage group size: %w", err)
}
@ -295,7 +295,7 @@ func (a *API) formStorageGroup(ctx context.Context, cnrID cid.ID, btoken bearer.
sg.SetValidationDataSize(sgSize)
sg.SetExpirationEpoch(networkInfo.CurrentEpoch() + uint64(*storageGroup.Lifetime))
if needCalcHash {
if !hashDisabled {
sg.SetValidationDataHash(*cs)
}