From 23136cf47afb4468eaf39bb7dc982872c3eff42a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sw=C3=A4rd?= Date: Sun, 4 Aug 2024 17:12:54 +0200 Subject: [PATCH] Fix problem with not storing agreement on consumer side after finalizing negotiation. (#45) --- dsp/statemachine/contract_transitions.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dsp/statemachine/contract_transitions.go b/dsp/statemachine/contract_transitions.go index 9520baa..5c2a30f 100644 --- a/dsp/statemachine/contract_transitions.go +++ b/dsp/statemachine/contract_transitions.go @@ -549,6 +549,15 @@ func verifyAndTransform( logger.Error("Could not set state", "err", err) return ctx, nil, fmt.Errorf("failed to save contract: %w", err) } + + if cn.GetContract().role == DataspaceConsumer && targetState == ContractStates.FINALIZED { + err = cn.GetArchiver().PutAgreement(ctx, &cn.GetContract().Copy().agreement) + if err != nil { + logger.Error("Could not set state", "err", err) + return ctx, nil, fmt.Errorf("failed to save agreement: %w", err) + } + } + ctx, cns := GetContractNegotiation(ctx, cn.GetArchiver(), cn.GetContract(), cn.GetProvider(), cn.GetReconciler()) return ctx, cns, nil }