Skip to content

Commit

Permalink
Fix a bug in the pending deposit projection
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Oct 4, 2024
1 parent 7a4756a commit 5139946
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion hydra-cluster/src/Hydra/Cluster/Scenarios.hs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ canSeePendingDeposits tracer workDir node hydraScriptsTxId =
forM_ deposited $ \deposit -> do
let path = BSC.unpack $ urlEncode False $ encodeUtf8 $ T.pack $ show deposit
recoverResp <-
parseUrlThrow ("DELETE " <> hydraNodeBaseUrl n1 <> "/commits/" <> spy path)
parseUrlThrow ("DELETE " <> hydraNodeBaseUrl n1 <> "/commits/" <> path)
>>= httpJSON

(getResponseBody recoverResp :: String) `shouldBe` "OK"
Expand Down
5 changes: 3 additions & 2 deletions hydra-node/src/Hydra/API/ServerOutput.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ data ServerOutput tx
| CommitApproved {headId :: HeadId, utxoToCommit :: UTxOType tx}
| DecommitFinalized {headId :: HeadId, decommitTxId :: TxIdType tx}
| CommitFinalized {headId :: HeadId, utxo :: UTxOType tx, theDeposit :: TxIdType tx}
| CommitRecovered {headId :: HeadId, recoveredUTxO :: UTxOType tx}
| CommitRecovered {headId :: HeadId, recoveredUTxO :: UTxOType tx, recoveredTxId :: TxIdType tx}
deriving stock (Generic)

deriving stock instance IsChainState tx => Eq (ServerOutput tx)
Expand Down Expand Up @@ -199,7 +199,7 @@ instance (ArbitraryIsTx tx, IsChainState tx) => Arbitrary (ServerOutput tx) wher
CommitRecorded headId u txId -> CommitRecorded headId <$> shrink u <*> shrink txId
CommitApproved headId u -> CommitApproved headId <$> shrink u
DecommitApproved headId txid u -> DecommitApproved headId txid <$> shrink u
CommitRecovered headId u -> CommitRecovered headId <$> shrink u
CommitRecovered headId u rid -> CommitRecovered headId <$> shrink u <*> shrink rid
DecommitFinalized{} -> []
CommitFinalized{} -> []

Expand Down Expand Up @@ -292,6 +292,7 @@ data CommitInfo
projectPendingDeposits :: IsTx tx => [TxIdType tx] -> ServerOutput tx -> [TxIdType tx]
projectPendingDeposits txIds = \case
CommitRecorded{pendingDeposit} -> pendingDeposit : txIds
CommitRecovered{recoveredTxId} -> filter (/= recoveredTxId) txIds
CommitFinalized{theDeposit} -> filter (/= theDeposit) txIds
_other -> txIds

Expand Down
1 change: 1 addition & 0 deletions hydra-node/src/Hydra/HeadLogic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ onOpenChainRecoverTx headId st recoveredUTxO recoveredTxId =
ServerOutput.CommitRecovered
{ headId
, recoveredUTxO
, recoveredTxId
}
)
where
Expand Down

0 comments on commit 5139946

Please sign in to comment.