Skip to content

Commit 145aca7

Browse files
bench: Use toJSON
1 parent 5137886 commit 145aca7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

hydra-cluster/bench/Bench/EndToEnd.hs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Control.Concurrent.Class.MonadSTM (
2121
import Control.Lens (to, (^?))
2222
import Control.Monad.Class.MonadAsync (mapConcurrently)
2323
import Data.Aeson (Result (Error, Success), Value, encode, fromJSON, (.=))
24-
import Data.Aeson.Lens (key, _Array, _JSON, _Number, _String)
24+
import Data.Aeson.Lens (key, _Array, _JSON, _Number, _String, _Object)
2525
import Data.List qualified as List
2626
import Data.Map qualified as Map
2727
import Data.Scientific (Scientific)
@@ -329,7 +329,7 @@ newTx registry client tx = do
329329
, invalidAt = Nothing
330330
, confirmedAt = Nothing
331331
}
332-
send client $ input "NewTx" ["transaction" .= serialiseToTextEnvelope Nothing tx]
332+
send client $ input "NewTx" ["transaction" .= toJSON tx]
333333

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

403403
maybeTxInvalid v = do
404404
guard (v ^? key "tag" == Just "TxInvalid")
405405
v
406-
^? key "txId" . to fromJSON >>= \case
406+
^? key "transaction" . key "txId" . to fromJSON >>= \case
407407
Error _ -> Nothing
408408
Success tx ->
409409
TxInvalid tx <$> v ^? key "validationError" . key "reason" . _String

0 commit comments

Comments
 (0)