From dd497b9876840ebda49651b851d1591521cba995 Mon Sep 17 00:00:00 2001 From: John Ky Date: Sat, 21 Jan 2023 17:59:04 +1100 Subject: [PATCH] Handle anyAddressInEra with onLeft --- cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs b/cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs index 4616715ab50..a87d49813da 100644 --- a/cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs +++ b/cardano-cli/src/Cardano/CLI/Shelley/Run/Transaction.hs @@ -729,9 +729,8 @@ runTxBuild era (AnyConsensusModeParams cModeParams) networkId mScriptValidity firstExceptT ShelleyTxCmdQueryNotScriptLocked . hoistEither $ notScriptLockedTxIns txinsc nodeEraUTxO - let cAddr = case anyAddressInEra era changeAddr of - Right addr -> addr - Left _ -> error $ "runTxBuild: Byron address used: " <> show changeAddr + cAddr <- pure (anyAddressInEra era changeAddr) + & onLeft (error $ "runTxBuild: Byron address used: " <> show changeAddr) -- should this throw instead? -- Why do we cast the era? The user can specify an era prior to the era that the node is currently in. -- We cannot use the user specified era to construct a query against a node because it may differ