From 6d716e4013e1a6df836c57e5fac7e08e313e115b Mon Sep 17 00:00:00 2001 From: Joseph Phillips Date: Tue, 8 Oct 2024 13:03:15 +0200 Subject: [PATCH] fix: ensure relation destroy ops are sorted As for offers in the prior commit, this ensures that relations can be forcibly removed without encountering errors based on transaction operations with removals before updates. --- state/relation.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/state/relation.go b/state/relation.go index b5d5876167f..7d2210e06ab 100644 --- a/state/relation.go +++ b/state/relation.go @@ -375,7 +375,10 @@ func (op *DestroyRelationOperation) internalDestroy() (ops []txn.Op, err error) } else if op.FatalError(err) { return nil, err } - return append(ops, destroyOps...), nil + + ops = append(ops, destroyOps...) + sortRemoveOpsLast(ops) + return ops, nil } // destroyOps returns the operations necessary to destroy the relation, and