Skip to content

Commit

Permalink
Small semantic cleanup so modifications to the blueprintTx are all se…
Browse files Browse the repository at this point in the history
…lf-contained (#1714)

As discussed during the hack-and-learn session, moving this down into
the `spendFromInitial` itself is a bit more semantically clear and
contained; it's necessary to sign it to spend it!
  • Loading branch information
noonio authored Oct 18, 2024
2 parents d55c4ef + c383d7b commit b718600
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hydra-tx/src/Hydra/Tx/Commit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput,
toLedgerTx blueprintTx
& spendFromInitial
& bodyTxL . outputsTxBodyL .~ StrictSeq.singleton (toLedgerTxOut commitOutput)
& bodyTxL . reqSignerHashesTxBodyL <>~ Set.singleton (toLedgerKeyHash vkh)
& bodyTxL . mintTxBodyL .~ mempty
& addMetadata (mkHydraHeadV1TxName "CommitTx") blueprintTx
where
Expand All @@ -76,6 +75,7 @@ commitTx networkId scriptRegistry headId party commitBlueprintTx (initialInput,
in tx
& bodyTxL . inputsTxBodyL .~ newInputs
& bodyTxL . referenceInputsTxBodyL <>~ Set.singleton (toLedgerTxIn initialScriptRef)
& bodyTxL . reqSignerHashesTxBodyL <>~ Set.singleton (toLedgerKeyHash vkh)
& witsTxL . rdmrsTxWitsL
.~ Redeemers (fromList $ nonSpendingRedeemers tx)
<> Redeemers (fromList $ mkRedeemers newRedeemers newInputs)
Expand Down

0 comments on commit b718600

Please sign in to comment.