Skip to content

Commit

Permalink
Re-order arguments of commitTx
Browse files Browse the repository at this point in the history
Idea of ordering: Most generic arguments first (networkId), then
protocol-specific (scriptRegistry), then head-specific (headId).
  • Loading branch information
ch1bo committed Feb 6, 2023
1 parent ceaf952 commit 8377393
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hydra-node/src/Hydra/Chain/Direct/State.hs
Expand Up @@ -296,9 +296,9 @@ commit ctx st utxo = do
case UTxO.pairs utxo of
[aUTxO] -> do
rejectByronAddress aUTxO
Right $ commitTx scriptRegistry networkId headId ownParty (Just aUTxO) initial
Right $ commitTx networkId scriptRegistry headId ownParty (Just aUTxO) initial
[] -> do
Right $ commitTx scriptRegistry networkId headId ownParty Nothing initial
Right $ commitTx networkId scriptRegistry headId ownParty Nothing initial
_ ->
Left (MoreThanOneUTxOCommitted @Tx)
where
Expand Down
4 changes: 2 additions & 2 deletions hydra-node/src/Hydra/Chain/Direct/Tx.hs
Expand Up @@ -160,9 +160,9 @@ mkInitialOutput networkId tokenPolicyId (verificationKeyHash -> pkh) =

-- | Craft a commit transaction which includes the "committed" utxo as a datum.
commitTx ::
NetworkId ->
-- | Published Hydra scripts to reference.
ScriptRegistry ->
NetworkId ->
HeadId ->
Party ->
-- | A single UTxO to commit to the Head
Expand All @@ -172,7 +172,7 @@ commitTx ::
-- locked by initial script
(TxIn, TxOut CtxUTxO, Hash PaymentKey) ->
Tx
commitTx scriptRegistry networkId headId party utxo (initialInput, out, vkh) =
commitTx networkId scriptRegistry headId party utxo (initialInput, out, vkh) =
unsafeBuildTransaction $
emptyTxBody
& addInputs [(initialInput, initialWitness)]
Expand Down
2 changes: 1 addition & 1 deletion hydra-node/test/Hydra/Chain/Direct/Contract/Commit.hs
Expand Up @@ -45,8 +45,8 @@ healthyCommitTx =
<> registryUTxO scriptRegistry
tx =
commitTx
scriptRegistry
Fixture.testNetworkId
scriptRegistry
(mkHeadId Fixture.testPolicyId)
commitParty
(Just healthyCommittedUTxO)
Expand Down

0 comments on commit 8377393

Please sign in to comment.