diff --git a/object/transformer/transformer.go b/object/transformer/transformer.go index f72ac0eb..b369b2e5 100644 --- a/object/transformer/transformer.go +++ b/object/transformer/transformer.go @@ -81,10 +81,10 @@ func (s *payloadSizeLimiter) initialize() { // initialize parent object once (after 1st object) if ln == 1 { s.parent = fromObject(s.current) - s.parentHashers = append(s.parentHashers[:0], s.currentHashers...) - - // return source attributes + s.parent.ResetRelations() + s.parent.SetSignature(nil) s.parent.SetAttributes(s.parAttrs...) + s.parentHashers = append(s.parentHashers[:0], s.currentHashers...) } // set previous object to the last previous identifier diff --git a/object/transformer/transformer_test.go b/object/transformer/transformer_test.go index 270697ef..ca9a1da5 100644 --- a/object/transformer/transformer_test.go +++ b/object/transformer/transformer_test.go @@ -55,15 +55,28 @@ func TestTransformer(t *testing.T) { require.Equal(t, h[:], cs.Value()) } + require.True(t, tt.objects[i].VerifyIDSignature()) switch i { case 0, 1: require.EqualValues(t, maxSize, len(payload)) + require.Nil(t, tt.objects[i].Parent()) case 2: require.EqualValues(t, maxSize/2, len(payload)) + parent := tt.objects[i].Parent() + require.NotNil(t, parent) + require.Nil(t, parent.SplitID()) + require.True(t, parent.VerifyIDSignature()) case 3: parID, ok := tt.objects[i].ParentID() require.True(t, ok) require.Equal(t, ids.ParentID, &parID) + + children := tt.objects[i].Children() + for j := 0; j < i; j++ { + id, ok := tt.objects[j].ID() + require.True(t, ok) + require.Equal(t, id, children[j]) + } } } require.Equal(t, expectedPayload, actualPayload)