Skip to content

Commit

Permalink
Query over single connection in runQueryLeadershipSchedule
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Jul 30, 2023
1 parent 7c0fa56 commit f622f47
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions cardano-cli/src/Cardano/CLI/Run/Legacy/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
$ shelleyBasedEraConstraints sbe
$ currentEpochEligibleLeadershipSlots
Expand All @@ -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
Expand Down

0 comments on commit f622f47

Please sign in to comment.