Skip to content

Commit

Permalink
bench: Use toJSON
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Jan 17, 2024
1 parent 5a6a73a commit b94bda4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hydra-cluster/bench/Bench/EndToEnd.hs
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ newTx registry client tx = do
, invalidAt = Nothing
, confirmedAt = Nothing
}
send client $ input "NewTx" ["transaction" .= serialiseToTextEnvelope Nothing tx]
send client $ input "NewTx" ["transaction" .= toJSON tx]

data WaitResult
= TxInvalid {transactionId :: TxId, reason :: Text}
Expand Down Expand Up @@ -396,14 +396,14 @@ waitForAllConfirmations n1 Registry{processedTxs} allIds = do
maybeTxValid v = do
guard (v ^? key "tag" == Just "TxValid")
v
^? key "txId" . to fromJSON >>= \case
^? key "transaction" . key "txId" . to fromJSON >>= \case
Error _ -> Nothing
Success txid -> pure $ TxValid txid

maybeTxInvalid v = do
guard (v ^? key "tag" == Just "TxInvalid")
v
^? key "txId" . to fromJSON >>= \case
^? key "transaction" . key "txId" . to fromJSON >>= \case
Error _ -> Nothing
Success tx ->
TxInvalid tx <$> v ^? key "validationError" . key "reason" . _String
Expand Down

0 comments on commit b94bda4

Please sign in to comment.