diff --git a/CHANGELOG.md b/CHANGELOG.md index 6932f670..f35f41d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ Changelog for NeoFS Node - Do not increase error counter in `engine.Inhume` if shard is read-only (#1839) - `control drop-objects` can remove split objects (#1830) - Node's status in `neofs-cli netmap nodeinfo` command (#1833) +- Child check in object assembly process of `ObjectService.Get` handler (#1878) ### Removed - Remove WIF and NEP2 support in `neofs-cli`'s --wallet flag (#1128) diff --git a/pkg/services/object/get/exec.go b/pkg/services/object/get/exec.go index 11365dce..bbb901ad 100644 --- a/pkg/services/object/get/exec.go +++ b/pkg/services/object/get/exec.go @@ -99,9 +99,13 @@ func (exec execCtx) address() oid.Address { return exec.prm.addr } +// isChild checks if reading object is a parent of the given object. +// Object without reference to the parent (only children with the parent header +// have it) is automatically considered as child: this should be guaranteed by +// upper level logic. func (exec execCtx) isChild(obj *objectSDK.Object) bool { par := obj.Parent() - return par != nil && equalAddresses(exec.address(), object.AddressOf(par)) + return par == nil || equalAddresses(exec.address(), object.AddressOf(par)) } func (exec execCtx) key() (*ecdsa.PrivateKey, error) { @@ -244,7 +248,7 @@ func (exec *execCtx) headChild(id oid.ID) (*objectSDK.Object, bool) { case err == nil: child := w.Object() - if _, ok := child.ParentID(); ok && !exec.isChild(child) { + if !exec.isChild(child) { exec.status = statusUndefined exec.log.Debug("parent address in child object differs")