From d803dd5232b40e5e69429dda752e659a9c6377a6 Mon Sep 17 00:00:00 2001 From: John Ky Date: Fri, 16 Jun 2023 13:50:39 +1000 Subject: [PATCH] Query over single connection in runQueryLeadershipSchedule --- .../src/Cardano/CLI/Shelley/Run/Query.hs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs b/cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs index 6e55197d84..a61131a228 100644 --- a/cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs +++ b/cardano-cli/src/Cardano/CLI/Shelley/Run/Query.hs @@ -1394,12 +1394,11 @@ runQueryLeadershipSchedule case whichSchedule of CurrentEpoch -> do - pure $ do - serCurrentEpochState <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing $ queryPoolDistribution eInMode sbe (Just (Set.singleton poolid))) - & onLeft (left . ShelleyQueryCmdAcquireFailure) - & onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion) - & onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError) + serCurrentEpochState <- lift (queryPoolDistribution eInMode sbe (Just (Set.singleton poolid))) + & onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion) + & onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError) + pure $ do schedule <- firstExceptT ShelleyQueryCmdLeaderShipError $ hoistEither $ eligibleLeaderSlotsConstaints sbe $ currentEpochEligibleLeadershipSlots @@ -1416,12 +1415,11 @@ runQueryLeadershipSchedule writeSchedule mJsonOutputFile eInfo shelleyGenesis schedule NextEpoch -> do - pure $ do - serCurrentEpochState <- lift (executeLocalStateQueryExpr localNodeConnInfo Nothing $ queryCurrentEpochState eInMode sbe) - & onLeft (left . ShelleyQueryCmdAcquireFailure) - & onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion) - & onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError) + serCurrentEpochState <- lift (queryCurrentEpochState eInMode sbe) + & onLeft (left . ShelleyQueryCmdUnsupportedNtcVersion) + & onLeft (left . ShelleyQueryCmdLocalStateQueryError . EraMismatchError) + pure $ do tip <- liftIO $ getLocalChainTip localNodeConnInfo schedule <- firstExceptT ShelleyQueryCmdLeaderShipError $ hoistEither