@@ -253,21 +253,20 @@ commitTx networkId scriptRegistry headId party commitTxDraft (initialInput, out,
253
253
ledgerBlueprintTx =
254
254
toLedgerTx draftTx
255
255
& bodyTxL . inputsTxBodyL <>~ Set. singleton (toLedgerTxIn initialInput)
256
- & bodyTxL . inputsTxBodyL <>~ Set. fromList (toLedgerTxIn <$> committedTxIns)
256
+ -- & bodyTxL . inputsTxBodyL <>~ Set.fromList (toLedgerTxIn <$> committedTxIns)
257
257
& bodyTxL . referenceInputsTxBodyL <>~ Set. fromList [toLedgerTxIn initialScriptRef]
258
258
& bodyTxL . outputsTxBodyL .~ StrictSeq. singleton (toLedgerTxOut commitOutput)
259
259
& bodyTxL . reqSignerHashesTxBodyL <>~ Set. singleton (toLedgerKeyHash vkh)
260
260
& bodyTxL . auxDataHashTxBodyL .~ SJust (hashAlonzoTxAuxData txAuxMetadata)
261
261
& bodyTxL . mintTxBodyL .~ mempty
262
262
& auxDataTxL .~ addMetadata txAuxMetadata
263
- existingWits = ledgerBlueprintTx ^. witsTxL
263
+ existingWits = toLedgerTx draftTx ^. witsTxL
264
264
currentInputs = ledgerBlueprintTx ^. bodyTxL . inputsTxBodyL
265
- commitInputs = Set. map toLedgerTxIn (UTxO. inputSet lookupUTxO)
266
265
blueprintRedeemers = unRedeemers $ toLedgerTx draftTx ^. witsTxL . rdmrsTxWitsL
267
266
wits =
268
267
witsTxL
269
268
.~ ( existingWits
270
- & rdmrsTxWitsL .~ rebuildSpendingRedeemers currentInputs commitInputs blueprintRedeemers
269
+ & rdmrsTxWitsL .~ rebuildSpendingRedeemers currentInputs committedTxIns blueprintRedeemers
271
270
)
272
271
in
273
272
fromLedgerTx $ ledgerBlueprintTx & wits
@@ -312,18 +311,19 @@ commitTx networkId scriptRegistry headId party commitTxDraft (initialInput, out,
312
311
Just ix ->
313
312
Map. lookup (AlonzoSpending (AsIndex $ fromIntegral ix)) oldTxRedeemers >>= Just . (key,)
314
313
315
- initialScript =
316
- fromPlutusScript @ PlutusScriptV2 Initial. validatorScript
314
+ -- initialScript =
315
+ -- fromPlutusScript @PlutusScriptV2 Initial.validatorScript
317
316
318
317
initialScriptRef =
319
318
fst (initialReference scriptRegistry)
320
319
321
320
initialRedeemer =
322
321
toScriptData . Initial. redeemer $
323
- Initial. ViaCommit (toPlutusTxOutRef <$> committedTxIns)
322
+ Initial. ViaCommit (toPlutusTxOutRef . fromLedgerTxIn <$> Set. toList committedTxIns)
324
323
325
- committedTxIns =
326
- fst <$> UTxO. pairs lookupUTxO
324
+ committedTxIns = toLedgerTx draftTx ^. bodyTxL . inputsTxBodyL
325
+ -- committedTxIns =
326
+ -- fst <$> UTxO.pairs lookupUTxO
327
327
328
328
commitOutput =
329
329
TxOut commitAddress commitValue commitDatum ReferenceScriptNone
@@ -334,16 +334,18 @@ commitTx networkId scriptRegistry headId party commitTxDraft (initialInput, out,
334
334
commitAddress =
335
335
mkScriptAddress @ PlutusScriptV2 networkId commitScript
336
336
337
+ utxoToCommit =
338
+ UTxO. fromPairs $ mapMaybe (\ txin -> (txin,) <$> UTxO. resolve txin lookupUTxO) (txIns' draftTx)
339
+
337
340
commitValue =
338
- txOutValue out <> foldMap txOutValue lookupUTxO
341
+ txOutValue out <> foldMap txOutValue utxoToCommit
339
342
340
343
commitDatum =
341
- mkTxOutDatumInline $ mkCommitDatum party lookupUTxO (headIdToCurrencySymbol headId)
344
+ mkTxOutDatumInline $ mkCommitDatum party utxoToCommit (headIdToCurrencySymbol headId)
342
345
343
346
TxMetadata metadataMap = mkHydraHeadV1TxName " CommitTx"
344
347
345
- txAuxMetadata = mkAlonzoTxAuxData @ [] @ LedgerEra (toShelleyMetadata metadataMap) [toLedgerScript initialScript]
346
-
348
+ txAuxMetadata = mkAlonzoTxAuxData @ [] @ LedgerEra (toShelleyMetadata metadataMap) [] -- toLedgerScript initialScript
347
349
CommitTxDraft {lookupUTxO, draftTx} = commitTxDraft
348
350
349
351
mkCommitDatum :: Party -> UTxO -> CurrencySymbol -> Plutus. Datum
0 commit comments