From f8670969fb935b4d0465e7277f5b9e168d9634c9 Mon Sep 17 00:00:00 2001 From: Ashraf Fouda Date: Tue, 17 Mar 2026 14:11:32 +0200 Subject: [PATCH] don't delete gws in grace period Signed-off-by: Ashraf Fouda --- pkg/gateway/gateway.go | 4 ++-- pkg/gateway_light/gateway.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/gateway/gateway.go b/pkg/gateway/gateway.go index 606e54a3..bf48289c 100644 --- a/pkg/gateway/gateway.go +++ b/pkg/gateway/gateway.go @@ -46,7 +46,7 @@ const ( var ( ErrTwinIDMismatch = fmt.Errorf("twin id mismatch") ErrContractNotReserved = fmt.Errorf("a name contract with the given name must be reserved first") - ErrInvalidContractState = fmt.Errorf("the name contract must be in Created state") + ErrInvalidContractState = fmt.Errorf("the name contract must be in Created or GracePeriod state") _ pkg.Gateway = (*gatewayModule)(nil) ) @@ -545,7 +545,7 @@ func (g *gatewayModule) validateNameContract(name string, twinID uint32) error { } else if subErr.IsError() { return subErr.Err } - if !contract.State.IsCreated { + if !contract.State.IsCreated && !contract.State.IsGracePeriod { return ErrInvalidContractState } if uint32(contract.TwinID) != twinID { diff --git a/pkg/gateway_light/gateway.go b/pkg/gateway_light/gateway.go index d3fdd053..024884ba 100644 --- a/pkg/gateway_light/gateway.go +++ b/pkg/gateway_light/gateway.go @@ -48,7 +48,7 @@ const ( var ( ErrTwinIDMismatch = fmt.Errorf("twin id mismatch") ErrContractNotReserved = fmt.Errorf("a name contract with the given name must be reserved first") - ErrInvalidContractState = fmt.Errorf("the name contract must be in Created state") + ErrInvalidContractState = fmt.Errorf("the name contract must be in Created or GracePeriod state") _ pkg.Gateway = (*gatewayModule)(nil) ) @@ -556,7 +556,7 @@ func (g *gatewayModule) validateNameContract(name string, twinID uint32) error { } else if subErr.IsError() { return subErr.Err } - if !contract.State.IsCreated { + if !contract.State.IsCreated && !contract.State.IsGracePeriod { return ErrInvalidContractState } if uint32(contract.TwinID) != twinID {