[#660] core/container: Use version.IsValid in CheckFormat

Container can have version later than the current lib version, and it should
not be considered as invalid. But it should still have adequate version.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-07-02 08:54:07 +03:00 committed by Alex Vanin
parent 8192933313
commit 54d6f3de55

View file

@ -4,9 +4,9 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/nspcc-dev/neofs-api-go/pkg"
"github.com/nspcc-dev/neofs-api-go/pkg/container" "github.com/nspcc-dev/neofs-api-go/pkg/container"
"github.com/nspcc-dev/neofs-api-go/pkg/owner" "github.com/nspcc-dev/neofs-api-go/pkg/owner"
"github.com/nspcc-dev/neofs-node/pkg/core/version"
) )
var ( var (
@ -24,8 +24,8 @@ func CheckFormat(c *container.Container) error {
return errNilPolicy return errNilPolicy
} }
if err := pkg.IsSupportedVersion(c.Version()); err != nil { if v := c.Version(); v == nil || !version.IsValid(*v) {
return fmt.Errorf("incorrect version: %w", err) return fmt.Errorf("incorrect version %s", v)
} }
if ln := len(c.OwnerID().ToV2().GetValue()); ln != owner.NEO3WalletSize { if ln := len(c.OwnerID().ToV2().GetValue()); ln != owner.NEO3WalletSize {