Skip to content

Commit

Permalink
Don't guard on txId when parsing from json
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed May 13, 2024
1 parent 708f2aa commit e278c4c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions hydra-node/src/Hydra/Ledger/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,9 @@ instance FromJSON Tx where
bytes <- decodeBase16 hexText
case deserialiseFromCBOR (proxyToAsType (Proxy @Tx)) bytes of
Left e -> fail $ show e
Right tx ->
(o .:? "txId") >>= \case
Nothing -> pure tx
Just txid' -> do
guard (txType tx == ty)
guard (txid' == txId tx)
pure tx
Right tx -> do
guard (txType tx == ty)
pure tx

instance Arbitrary Tx where
-- TODO: shrinker!
Expand Down

0 comments on commit e278c4c

Please sign in to comment.