From 9d0014366a094bf571f8664a3e1e5b0928649a05 Mon Sep 17 00:00:00 2001 From: Sasha Bogicevic Date: Thu, 12 Jan 2023 13:31:31 +0100 Subject: [PATCH] Use first output as the head one in v_commit --- hydra-plutus/src/Hydra/Contract/Commit.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hydra-plutus/src/Hydra/Contract/Commit.hs b/hydra-plutus/src/Hydra/Contract/Commit.hs index 79984e997d0..19ab90e37fe 100644 --- a/hydra-plutus/src/Hydra/Contract/Commit.hs +++ b/hydra-plutus/src/Hydra/Contract/Commit.hs @@ -98,9 +98,13 @@ validator (_party, _headScriptHash, _commit, headId) r ctx = ViaAbort -> traceIfFalse "ST not burned" (mustBurnST (txInfoMint $ scriptContextTxInfo ctx) headId) ViaCollectCom -> - traceIfFalse "ST is missing in the output" (hasST headId outputs) + traceIfFalse "ST is missing in the output" (hasST headId headOutputValue) where - outputs = foldMap txOutValue $ txInfoOutputs $ scriptContextTxInfo ctx + headOutputValue = + case txInfoOutputs (scriptContextTxInfo ctx) of + [] -> mempty + (headOutput : _) -> + txOutValue headOutput compiledValidator :: CompiledCode ValidatorType compiledValidator =