Skip to content

Commit 6e132e5

Browse files
committed
Fix bug related to intial utxo hash for the decommit values
1 parent a7c75f2 commit 6e132e5

File tree

2 files changed

+2
-4
lines changed
  • hydra-node/src/Hydra/Chain/Direct
  • hydra-plutus/src/Hydra/Contract

2 files changed

+2
-4
lines changed

hydra-node/src/Hydra/Chain/Direct/Tx.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ closeTx scriptRegistry vk closing startSlotNo (endSlotNo, utcTime) openThreadOut
571571
}
572572

573573
(UTxOHash utxoHashBytes, UTxOHash decommitUTxOHashBytes, snapshotNumber, signature) = case closing of
574-
CloseWithInitialSnapshot{openUtxoHash} -> (openUtxoHash, mempty, 0, mempty)
574+
CloseWithInitialSnapshot{openUtxoHash} -> (openUtxoHash, UTxOHash $ hashUTxO @Tx mempty, 0, mempty)
575575
CloseWithConfirmedSnapshot{closeUtxoHash, closeUtxoToDecommitHash, snapshotNumber = sn, signatures = s} ->
576576
(closeUtxoHash, closeUtxoToDecommitHash, toInteger sn, toPlutusSignatures s)
577577

hydra-plutus/src/Hydra/Contract/Head.hs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,7 @@ checkFanout utxoHash utxoToDecommitHash contestationDeadline numberOfFanoutOutpu
501501

502502
hasSameUTxOHash =
503503
traceIfFalse $(errorCode FannedOutUtxoHashNotEqualToClosedUtxoHash) $
504-
-- TODO: revisit and make sure hashing the empty list like here produces
505-
-- the correct utxo hash when there are no decommits happening.
506-
fannedOutUtxoHash == utxoHash -- && decommitUtxoHash == utxoToDecommitHash
504+
fannedOutUtxoHash == utxoHash && decommitUtxoHash == utxoToDecommitHash
507505
fannedOutUtxoHash = hashTxOuts $ take numberOfFanoutOutputs txInfoOutputs
508506

509507
decommitUtxoHash = hashTxOuts $ take numberOfDecommitOutputs $ drop numberOfFanoutOutputs txInfoOutputs

0 commit comments

Comments
 (0)