From 739447579ad53f73d04b83a22a6e1a26a3168ca0 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Wed, 3 Aug 2022 12:35:43 +0300 Subject: [PATCH] [#36] Fix needHash flag Signed-off-by: Denis Kirillov --- handlers/storagegroup.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/handlers/storagegroup.go b/handlers/storagegroup.go index 232f51a..e3afb30 100644 --- a/handlers/storagegroup.go +++ b/handlers/storagegroup.go @@ -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) }